#!/bin/sh
#
# $NetBSD: INSTALL,v 1.1 2001/04/29 20:36:48 jlam Exp $

PKGNAME=$1
STAGE=$2

CAT="@CAT@"
CHMOD="@CHMOD@"
CP="@CP@"
MKDIR="@MKDIR@"

SERVERROOT="@APACHE_SYSCONFDIR@"
SAMPLECONFDIR=${PKG_PREFIX}/share/examples/mod_ssl
CONFDIR=${SERVERROOT}
CONFFILES="apache_start.conf"
NONCONFFILES="	ssl.crl/Makefile.crl					\
		ssl.crl/README.CRL					\
		ssl.crt/Makefile.crt					\
		ssl.crt/README.CRT					\
		ssl.crt/ca-bundle.crt					\
		ssl.csr/README.CSR					\
		ssl.key/README.KEY					\
		ssl.prm/README.PRM"

case ${STAGE} in
PRE-INSTALL)
	;;

POST-INSTALL)
	# ${SERVERROOT} (${CONFDIR}) is already set up by apache/pkg/INSTALL,
	# so we don't need to create those directories here.

	echo "Installing configuration files:"
	for file in ${CONFFILES} ${NONCONFFILES}
	do
		FILE=${CONFDIR}/${file}
		SAMPLEFILE=${SAMPLECONFDIR}/${file}
		if [ -f ${FILE} ]
		then
			echo "    ${FILE} already exists"
		else
			echo "    ${FILE}"
			${CP} ${SAMPLEFILE} ${FILE}
			${CHMOD} 644 ${FILE}
		fi
	done
	${CAT} << EOF

===========================================================================
Some files you might need to customize include the following:

EOF
	for file in ${CONFFILES}
	do
		FILE=${CONFDIR}/${file}
		echo "	${FILE}"
	done
        ${CAT} << EOF
===========================================================================
EOF
	;;

*)
	echo "Unexpected argument: ${STAGE}"
	exit 1
	;;
esac
exit 0
