diff options
author | jlam <jlam@pkgsrc.org> | 2000-12-22 19:41:52 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2000-12-22 19:41:52 +0000 |
commit | cbfbe4c8d8a96c85aa5f8c079ca6cda08ff60093 (patch) | |
tree | cab26a2236033d81c0d3f5610abc6bee21e2f9b9 /www/apache | |
parent | b646d1dad69fefde3c0c03cb188ca621fc6b6c07 (diff) | |
download | pkgsrc-cbfbe4c8d8a96c85aa5f8c079ca6cda08ff60093.tar.gz |
Make the INSTALL/DEINSTALL scripts handle configuration files like
cups: copy sample config files to default config files, and remove
the config files on deinstall if they're identical to the sample ones.
Diffstat (limited to 'www/apache')
-rw-r--r-- | www/apache/Makefile | 15 | ||||
-rw-r--r-- | www/apache/pkg/DEINSTALL | 110 | ||||
-rw-r--r-- | www/apache/pkg/INSTALL | 68 |
3 files changed, 150 insertions, 43 deletions
diff --git a/www/apache/Makefile b/www/apache/Makefile index 2d0aac03303..c34b99d0829 100644 --- a/www/apache/Makefile +++ b/www/apache/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.54 2000/12/11 00:03:08 jlam Exp $ +# $NetBSD: Makefile,v 1.55 2000/12/22 19:41:52 jlam Exp $ # # The fourth number in the PKGNAME version indicates a NetBSD pkg revision # (to indicate changes in the shipped third party patches such as the mod_ssl @@ -76,6 +76,9 @@ CONFIGURE_ENV+= LIBS="-ldbm -ldb2" BUILD_DEFS+= APACHE_PERF_TUNING APACHE_SUEXEC +DEINSTALL_FILE= ${WRKDIR}/DEINSTALL +INSTALL_FILE= ${WRKDIR}/INSTALL + # Note that there is NO static compile module hook here. This is intentional. # Under Apache 1.3, modules can be compiled to link dynamically to the server # using the "apxs" program. See apxs(8). @@ -103,6 +106,16 @@ post-build: pre-install: ${FIND} ${WRKSRC}/htdocs -name '*.orig' -exec ${RM} -f {} \; + ${SED} -e "s,@CAT@,${CAT},g" \ + -e "s,@RM@,${RM},g" \ + -e "s,@RMDIR@,${RMDIR},g" \ + -e "s,@TRUE@,${TRUE},g" \ + < ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE} + ${SED} -e "s,@CAT@,${CAT},g" \ + -e "s,@CHMOD@,${CHMOD},g" \ + -e "s,@CP@,${CP},g" \ + -e "s,@MKDIR@,${MKDIR},g" \ + < ${PKGDIR}/INSTALL > ${INSTALL_FILE} post-install: .if !defined(NOPIC) diff --git a/www/apache/pkg/DEINSTALL b/www/apache/pkg/DEINSTALL index 6e25e23fb05..630c9822650 100644 --- a/www/apache/pkg/DEINSTALL +++ b/www/apache/pkg/DEINSTALL @@ -1,39 +1,107 @@ #!/bin/sh # -# $NetBSD: DEINSTALL,v 1.3 2000/10/13 21:46:46 jlam Exp $ +# $NetBSD: DEINSTALL,v 1.4 2000/12/22 19:41:53 jlam Exp $ PKGNAME=$1 STAGE=$2 +CAT="@CAT@" +RM="@RM@" +RMDIR="@RMDIR@" +TRUE="@TRUE@" + +SERVERROOT=${PKG_PREFIX}/etc/httpd +LOGDIR=/var/log/httpd +SPOOLDIR=/var/spool/httpd +SAMPLECONFDIR=${SERVERROOT} +CONFDIR=${SERVERROOT} +CONFFILES="httpd.conf" +NONCONFFILES="magic mime.types" + case ${STAGE} in DEINSTALL) + # Remove configuration files if they don't differ from the default + # config file. + # + for file in ${CONFFILES} ${NONCONFFILES} + do + FILE=${CONFDIR}/${file} + SAMPLEFILE=${SAMPLECONFDIR}/${file}.default + if diff -q ${FILE} ${SAMPLEFILE} >/dev/null + then + ${RM} -f ${FILE} + fi + done ;; + POST-DEINSTALL) - SERVERROOT=${PKG_PREFIX}/etc/httpd - LOGDIR=/var/log/httpd - SPOOLDIR=/var/spool/httpd - - rmdir ${SPOOLDIR}/proxy 2>/dev/null || true - rmdir ${SPOOLDIR} 2>/dev/null || true - rmdir ${LOGDIR} 2>/dev/null || true - rmdir ${SERVERROOT}/ssl.prm 2>/dev/null || true - rmdir ${SERVERROOT}/ssl.key 2>/dev/null || true - rmdir ${SERVERROOT}/ssl.csr 2>/dev/null || true - rmdir ${SERVERROOT}/ssl.crt 2>/dev/null || true - rmdir ${SERVERROOT}/ssl.crl 2>/dev/null || true - rmdir ${SERVERROOT} 2>/dev/null || true - - cat << EOF + modified_files='' + for file in ${CONFFILES} ${NONCONFFILES} + do + FILE=${CONFDIR}/${file} + if [ -f ${FILE} ] + then + modified_files="${modified_files} ${FILE}" + fi + done + + ${RMDIR} ${SPOOLDIR}/proxy 2>/dev/null || ${TRUE} + ${RMDIR} ${SPOOLDIR} 2>/dev/null || ${TRUE} + ${RMDIR} ${LOGDIR} 2>/dev/null || ${TRUE} + ${RMDIR} ${SERVERROOT}/ssl.prm 2>/dev/null || ${TRUE} + ${RMDIR} ${SERVERROOT}/ssl.key 2>/dev/null || ${TRUE} + ${RMDIR} ${SERVERROOT}/ssl.csr 2>/dev/null || ${TRUE} + ${RMDIR} ${SERVERROOT}/ssl.crt 2>/dev/null || ${TRUE} + ${RMDIR} ${SERVERROOT}/ssl.crl 2>/dev/null || ${TRUE} + ${RMDIR} ${SERVERROOT} 2>/dev/null || ${TRUE} + + existing_dirs='' + for dir in ${CONFDIR} ${LOGDIR} ${REQUESTDIR} + do + if [ -d ${dir} ] + then + existing_dirs="${existing_dirs} ${dir}" + fi + done + + if [ -n "${modified_files}" -o -n "${existing_dirs}" ] + then + ${CAT} << EOF =========================================================================== -If you won't be using ${PKGNAME} any longer, you may want to remove the -following directories: +If you won't be using ${PKGNAME} any longer, you may want to remove: + +EOF + if [ -n "${modified_files}" ] + then + ${CAT} << EOF - ${SERVERROOT} - ${LOGDIR} - ${SPOOLDIR} + * the following files: + +EOF + for file in ${modified_files} + do + echo " ${file}" + done + fi + if [ -n "${existing_dirs}" ] + then + ${CAT} << EOF + + * the following directories: + +EOF + for dir in ${existing_dirs} + do + echo " ${dir}" + done + fi + ${CAT} << EOF =========================================================================== EOF + fi + ;; + *) echo "Unexpected argument: ${STAGE}" exit 1 diff --git a/www/apache/pkg/INSTALL b/www/apache/pkg/INSTALL index 9ee3eaab221..ff9c0f01988 100644 --- a/www/apache/pkg/INSTALL +++ b/www/apache/pkg/INSTALL @@ -1,42 +1,68 @@ #!/bin/sh # -# $NetBSD: INSTALL,v 1.2 2000/10/13 21:46:46 jlam Exp $ +# $NetBSD: INSTALL,v 1.3 2000/12/22 19:41:53 jlam Exp $ PKGNAME=$1 STAGE=$2 +CAT="@CAT@" +CHMOD="@CHMOD@" +CP="@CP@" +MKDIR="@MKDIR@" + +SERVERROOT=${PKG_PREFIX}/etc/httpd +LOGDIR=/var/log/httpd +SPOOLDIR=/var/spool/httpd +SAMPLECONFDIR=${SERVERROOT} +CONFDIR=${SERVERROOT} +CONFFILES="httpd.conf" +NONCONFFILES="magic mime.types" + case ${STAGE} in PRE-INSTALL) ;; + POST-INSTALL) - SERVERROOT=${PKG_PREFIX}/etc/httpd - LOGDIR=/var/log/httpd - SPOOLDIR=/var/spool/httpd - - mkdir -p ${SERVERROOT} - mkdir -p ${SERVERROOT}/ssl.crl - mkdir -p ${SERVERROOT}/ssl.crt - mkdir -p ${SERVERROOT}/ssl.csr - mkdir -p ${SERVERROOT}/ssl.key - mkdir -p ${SERVERROOT}/ssl.prm - mkdir -p ${LOGDIR} - mkdir -p ${SPOOLDIR} - mkdir -p ${SPOOLDIR}/proxy + ${MKDIR} ${SERVERROOT} + ${MKDIR} ${SERVERROOT}/ssl.crl + ${MKDIR} ${SERVERROOT}/ssl.crt + ${MKDIR} ${SERVERROOT}/ssl.csr + ${MKDIR} ${SERVERROOT}/ssl.key + ${MKDIR} ${SERVERROOT}/ssl.prm + ${MKDIR} ${LOGDIR} + ${MKDIR} ${SPOOLDIR} + ${MKDIR} ${SPOOLDIR}/proxy echo "Installing configuration files:" - for file in httpd.conf magic mime.types + for file in ${CONFFILES} ${NONCONFFILES} do - if [ -f ${SERVERROOT}/${file} ] + FILE=${CONFDIR}/${file} + SAMPLEFILE=${SAMPLECONFDIR}/${file}.default + if [ -f ${FILE} ] then - echo " ${SERVERROOT}/${file} already exists" + echo " ${FILE} already exists" else - echo " ${SERVERROOT}/${file}.default --> ${SERVERROOT}/${file}" - cp ${SERVERROOT}/${file}.default ${SERVERROOT}/${file} - chmod 644 ${SERVERROOT}/${file} + echo " ${FILE}" + ${CP} ${SAMPLEFILE} ${FILE} + ${CHMOD} 644 ${FILE} fi done - echo "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 |