diff options
author | jlam <jlam@pkgsrc.org> | 2000-10-31 13:48:37 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2000-10-31 13:48:37 +0000 |
commit | 73e5654be3950ff08fca92e51f8dc2a789007e22 (patch) | |
tree | ae572acb8183e6fef92da389d0ee4ab66564ad7a /www/surfraw | |
parent | 9a528bc0bcc4c548597768b1bd95776306e52569 (diff) | |
download | pkgsrc-73e5654be3950ff08fca92e51f8dc2a789007e22.tar.gz |
Handle configuration files:
* During installation, install a default file, then copy over a real
config file during post-installation if it doesn't already exist.
* During de-installation, remove the real config file if it doesn't
differ from the default config file.
The INSTALL/DEINSTALL scripts could probably serve as a model for how other
packages should deal with config files.
Diffstat (limited to 'www/surfraw')
-rw-r--r-- | www/surfraw/Makefile | 4 | ||||
-rw-r--r-- | www/surfraw/files/patch-sum | 3 | ||||
-rw-r--r-- | www/surfraw/patches/patch-aa | 22 | ||||
-rw-r--r-- | www/surfraw/pkg/DEINSTALL | 58 | ||||
-rw-r--r-- | www/surfraw/pkg/INSTALL | 48 | ||||
-rw-r--r-- | www/surfraw/pkg/PLIST | 4 |
6 files changed, 136 insertions, 3 deletions
diff --git a/www/surfraw/Makefile b/www/surfraw/Makefile index 86107bb0338..e16f1e2439b 100644 --- a/www/surfraw/Makefile +++ b/www/surfraw/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2000/10/31 13:10:18 jlam Exp $ +# $NetBSD: Makefile,v 1.7 2000/10/31 13:48:37 jlam Exp $ # DISTNAME= surfraw-1.0.2 @@ -17,5 +17,7 @@ DOCDIR= ${PREFIX}/share/doc/surfraw post-install: ${INSTALL_DATA_DIR} ${DOCDIR} ${INSTALL_DATA} ${WRKSRC}/README ${DOCDIR} + ${INSTALL_DATA} ${WRKSRC}/surfraw.conf ${PREFIX}/etc/surfraw.conf.dist + PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL .include "../../mk/bsd.pkg.mk" diff --git a/www/surfraw/files/patch-sum b/www/surfraw/files/patch-sum new file mode 100644 index 00000000000..2eb3b79edf4 --- /dev/null +++ b/www/surfraw/files/patch-sum @@ -0,0 +1,3 @@ +$NetBSD: patch-sum,v 1.1 2000/10/31 13:48:38 jlam Exp $ + +MD5 (patch-aa) = 8fd99e88614e0721da02b5eddaa120cb diff --git a/www/surfraw/patches/patch-aa b/www/surfraw/patches/patch-aa new file mode 100644 index 00000000000..35b2c03dba9 --- /dev/null +++ b/www/surfraw/patches/patch-aa @@ -0,0 +1,22 @@ +$NetBSD: patch-aa,v 1.1 2000/10/31 13:48:38 jlam Exp $ + +--- Makefile.in.orig Tue Sep 26 15:54:35 2000 ++++ Makefile.in +@@ -313,7 +313,7 @@ + check: check-recursive + installcheck-am: + installcheck: installcheck-recursive +-install-exec-am: install-binSCRIPTS install-sysconfDATA ++install-exec-am: install-binSCRIPTS + install-exec: install-exec-recursive + + install-data-am: +@@ -322,7 +322,7 @@ + install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + install: install-recursive +-uninstall-am: uninstall-binSCRIPTS uninstall-sysconfDATA ++uninstall-am: uninstall-binSCRIPTS + uninstall: uninstall-recursive + all-am: Makefile $(SCRIPTS) $(DATA) + all-redirect: all-recursive diff --git a/www/surfraw/pkg/DEINSTALL b/www/surfraw/pkg/DEINSTALL new file mode 100644 index 00000000000..37485383cea --- /dev/null +++ b/www/surfraw/pkg/DEINSTALL @@ -0,0 +1,58 @@ +#!/bin/sh +# +# $NetBSD: DEINSTALL,v 1.1 2000/10/31 13:48:39 jlam Exp $ + +PKGNAME=$1 +STAGE=$2 + +CONFDIR=${PKG_PREFIX}/etc +CONFFILES="surfraw.conf" + +case ${STAGE} in +DEINSTALL) + # Remove configuration files if they don't differ from the default + # config file. + # + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + if diff -q ${FILE} ${FILE}.dist >/dev/null + then + rm -f ${FILE} + fi + done + ;; +POST-DEINSTALL) + CONFDIR=${PKG_PREFIX}/etc + modified_files='' + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + if [ -f ${FILE} ] + then + modified_files="${modified_files} ${FILE}" + fi + done + if [ -n "${modified_files}" ] + then + cat << EOF +=========================================================================== +If you won't be using ${PKGNAME} any longer, you may want to remove the +following files: + +EOF + for file in ${modified_files} + do + echo " ${file}" + done + cat << EOF +=========================================================================== +EOF + fi + ;; +*) + echo "Unexpected argument: ${STAGE}" + exit 1 + ;; +esac +exit 0 diff --git a/www/surfraw/pkg/INSTALL b/www/surfraw/pkg/INSTALL new file mode 100644 index 00000000000..299722508af --- /dev/null +++ b/www/surfraw/pkg/INSTALL @@ -0,0 +1,48 @@ +#! /bin/sh +# +# $NetBSD: INSTALL,v 1.1 2000/10/31 13:48:39 jlam Exp $ + +PKGNAME=$1 +STAGE=$2 + +CONFDIR=${PKG_PREFIX}/etc +CONFFILES="surfraw.conf" + +case ${STAGE} in +PRE-INSTALL) + ;; +POST-INSTALL) + + echo "Installing configuration files:" + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + if [ -f ${FILE} ] + then + echo " ${FILE} already exists" + else + echo " ${FILE}" + cp ${FILE}.dist ${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 diff --git a/www/surfraw/pkg/PLIST b/www/surfraw/pkg/PLIST index 65f7c74f5ff..eacb7225fe8 100644 --- a/www/surfraw/pkg/PLIST +++ b/www/surfraw/pkg/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.6 2000/10/31 13:10:18 jlam Exp $ +@comment $NetBSD: PLIST,v 1.7 2000/10/31 13:48:39 jlam Exp $ bin/W bin/altavista bin/appwatch @@ -34,7 +34,7 @@ bin/webster bin/wetandwild bin/xxx bin/yahoo -etc/surfraw.conf +etc/surfraw.conf.dist etc/surfraw_elvi.list share/doc/surfraw/README @dirrm share/doc/surfraw |