#! /bin/ksh

if [ -z "$1" ]; then
  echo "ERROR: Invoke with path to packaging dist tree root"
  exit 1
fi

if [ ! -d $1/dist ]; then
  echo "ERROR: no dist/ directory"
  exit 1
fi

if [ ! -d $1/dist/apache/etc ]; then
  mkdir $1/dist/apache/etc
  cp apache.etc $1/dist/apache/etc/apache
fi

cp -f httpd.conf.default $1/dist/apache/usr/lib/apache/conf

for i in AxKit apache modperl modssl perlASP php4; do
  if [ ! -d $1/dist/$i/cntl ]; then
    mkdir -p $1/dist/$i/cntl
    cp $i/cntl/* $1/dist/$i/cntl/
  fi
done

mkcdmt -d $1 -P Apache -D "Apache Web Server 1.3.28" -V 5.0.7Ga -E -p apache.mkcdmt
