summaryrefslogtreecommitdiff
path: root/www/wwwoffle
diff options
context:
space:
mode:
authorfredb <fredb>2002-08-10 17:03:26 +0000
committerfredb <fredb>2002-08-10 17:03:26 +0000
commitde3bfeee66e09dda092de7631e93c1f1ad3eb9dc (patch)
tree19800b409013ea5e6ddf758bb587f996e86c0768 /www/wwwoffle
parent31b382ae1b9c31477d092357991a0a6e4b3daaa6 (diff)
downloadpkgsrc-de3bfeee66e09dda092de7631e93c1f1ad3eb9dc.tar.gz
Really respect ${PKG_SYSCONFDIR}, and account for the fact that it may
have moved since the last installation. Make myself the maintainer of this package.
Diffstat (limited to 'www/wwwoffle')
-rw-r--r--www/wwwoffle/INSTALL74
-rw-r--r--www/wwwoffle/Makefile29
-rw-r--r--www/wwwoffle/PLIST5
-rw-r--r--www/wwwoffle/files/wwwoffled6
4 files changed, 82 insertions, 32 deletions
diff --git a/www/wwwoffle/INSTALL b/www/wwwoffle/INSTALL
index 6e24b5abcc2..7b823d58dbb 100644
--- a/www/wwwoffle/INSTALL
+++ b/www/wwwoffle/INSTALL
@@ -1,25 +1,67 @@
#!/bin/sh
#
-# $NetBSD: INSTALL,v 1.1 2002/03/10 22:14:29 fredb Exp $
+# $NetBSD: INSTALL,v 1.2 2002/08/10 17:03:26 fredb Exp $
-PATH=${PKG_PREFIX+${PKG_PREFIX}/sbin:}${PATH}
+if [ X"${2}" != XPOST-INSTALL ]
+then
+ exit 0
+fi
+
+PKG_PREFIX="${PKG_PREFIX-/usr/pkg}"
+PATH="${PKG_PREFIX}/sbin":"${PATH}"
+NEW_CONF_EXAMPLE="${PKG_PREFIX}/share/examples/wwwoffle.conf"
+
+# Allow ${CONFDIR} to be set in the environment, so that this unsubstituted
+# script can be run directly from the "pkgsrc" subdirectory via `make finish'.
+if [ ! -e "${CONFDIR}"/wwwoffle.conf ]
+then
+ CONFDIR="@PKG_SYSCONFDIR@"
+fi
-# Make an educated guess:
-if [ -e ${PKG_PREFIX-/usr/pkg}/etc/wwwoffle ]
+if [ ! -d "${CONFDIR}" ]
then
- CONFDIR=${PKG_PREFIX-/usr/pkg}/etc/wwwoffle
-else
- CONFDIR=/etc/wwwoffle
+ mkdir -p "${CONFDIR}"
fi
-if [ X"${2}" = XPOST-INSTALL ]
+# If there's no configuration file in the new ${PKG_SYSCONFDIR}, search
+# possible former locations for the old file. If none found, install a
+# fresh one.
+if [ ! -e "${CONFDIR}/wwwoffle.conf" ]
then
- for p in `find /var/wwwoffle/html -name wwwoffle.pac`
- do
- cd `dirname ${p}`
- mv ${p} ${p}.dist
- sed /PROXY/s/localhost/`hostname`/ ${p}.dist > ${p}
- done
- cd ${CONFDIR} && wwwoffle-upgrade-config.pl wwwoffle.conf || true
- wwwoffle-convert-cache /var/wwwoffle
+ if [ -e /etc/wwwoffle.conf ]
+ then
+ conf_candidates=/etc/wwwoffle.conf
+ fi
+ if [ -e "${PKG_PREFIX}/etc/wwwoffle.conf" ]
+ then
+ conf_candidates="${PKG_PREFIX}/etc/wwwoffle.conf"
+ fi
+ OLD_CONF="$(ls -rt $conf_candidates | tail -1)"
+ if [ -n "$OLD_CONF" ]
+ then
+ cp "${OLD_CONF}" "${CONFDIR}/wwwoffle.conf"
+ else
+ cp "${NEW_CONF_EXAMPLE}" "${CONFDIR}/wwwoffle.conf"
+ fi
fi
+
+# The "wwwoffle-upgrade-config" script needs the template to be in ${CONFDIR}.
+if [ ! -e "${CONFDIR}/wwwoffle.conf.install" ]
+then
+ cp "${NEW_CONF_EXAMPLE}" "${CONFDIR}/wwwoffle.conf.install"
+fi
+
+# Put the real hostname in the "wwwoffle.pac" file.
+for p in `find /var/wwwoffle/html -name wwwoffle.pac`
+do
+ cd `dirname ${p}`
+ mv ${p} ${p}.dist
+ sed /PROXY/s/localhost/`hostname`/ ${p}.dist > ${p}
+done
+
+# Now utilize the install utilities to upgrade the configuration file and
+# convert the cache format. Don't require "perl" just to upgrade the config,
+# as there may not even be an old config file, and worst case, the user will
+# get warnings in "syslog" about deprecated options.
+cd ${CONFDIR} && wwwoffle-upgrade-config.pl wwwoffle.conf || true
+wwwoffle-convert-cache /var/wwwoffle
diff --git a/www/wwwoffle/Makefile b/www/wwwoffle/Makefile
index 7c1e6029e94..71656dcc8a2 100644
--- a/www/wwwoffle/Makefile
+++ b/www/wwwoffle/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.40 2002/08/07 09:15:43 jlam Exp $
+# $NetBSD: Makefile,v 1.41 2002/08/10 17:03:26 fredb Exp $
DISTNAME= wwwoffle-2.7c
PKGREVISION= 2
@@ -8,33 +8,41 @@ MASTER_SITES= ftp://ftp.demon.co.uk/pub/unix/httpd/ \
${MASTER_SITE_SUNSITE:=apps/www/servers/}
EXTRACT_SUFX= .tgz
-MAINTAINER= packages@netbsd.org
+MAINTAINER= fredb@netbsd.org
HOMEPAGE= http://www.gedanken.demon.co.uk/wwwoffle/
COMMENT= WWW proxy with support for offline browsing
USE_GMAKE= yes
GNU_CONFIGURE= yes
-CONFIGURE_ARGS+= --with-confdir=${PKG_SYSCONFDIR}/wwwoffle
+CONFIGURE_ARGS+= --with-confdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+= --with-spooldir=/var/wwwoffle
+PKG_SYSCONFSUBDIR= wwwoffle
PLIST_SUBST+= GTAR="${GTAR}" PKG_SYSCONFDIR="${PKG_SYSCONFDIR}"
+INSTALL_FILE= ${WRKDIR}/INSTALL
post-build:
cd ${WRKSRC}/cache/search/htdig/scripts; \
for f in wwwoffle-ht*; do \
${MV} $$f $$f.old; \
${SED} -e '/htsearch/s#^#${PREFIX}/libexec/cgi-bin/#' \
- -e 's#/usr/local#${PREFIX}#' <$$f.old >$$f; \
+ -e 's#/usr/local#${PREFIX}#' $$f.old > $$f; \
${RM} $$f.old; \
done
- @${SED} -e 's#@PREFIX@#${PREFIX}#g' <${FILESDIR}/wwwoffled \
- >${WRKDIR}/wwwoffled
+ ${SED} -e 's#@PKG_SYSCONFDIR@#${PKG_SYSCONFDIR}#g' \
+ -e 's#@PREFIX@#${PREFIX}#g' \
+ ${FILESDIR}/wwwoffled > ${WRKDIR}/wwwoffled
+ ${SED} -e 's#@PKG_SYSCONFDIR@#${PKG_SYSCONFDIR}#g' \
+ INSTALL > ${WRKDIR}/INSTALL
post-install:
- if [ ! -f ${PREFIX}/etc/wwwoffle/wwwoffle.conf.install ]; then \
- ${CP} -p ${PREFIX}/etc/wwwoffle/wwwoffle.conf \
- ${PREFIX}/etc/wwwoffle/wwwoffle.conf.install; \
+ if [ -f ${PKG_SYSCONFDIR}/wwwoffle.conf.install ]; then \
+ ${CP} -p ${PKG_SYSCONFDIR}/wwwoffle.conf.install \
+ ${PREFIX}/share/examples/wwwoffle.conf; \
+ elif [ -f ${PKG_SYSCONFDIR}/wwwoffle.conf ]; then \
+ ${CP} -p ${PKG_SYSCONFDIR}/wwwoffle.conf \
+ ${PREFIX}/share/examples/wwwoffle.conf; \
fi
${INSTALL_PROGRAM} ${WRKSRC}/src/convert-cache \
${PREFIX}/sbin/wwwoffle-convert-cache
@@ -65,7 +73,8 @@ post-install:
# package build machines, not to mention putting the wrong information
# into the "wwwoffle.pac" files.
finish:
- ${SH} INSTALL _ POST-INSTALL
+ ${SETENV} CONFDIR="${PKG_SYSCONFDIR}" PKG_PREFIX="${PREFIX}" \
+ ${SH} INSTALL _ POST-INSTALL
.include "../../mk/bsd.prefs.mk"
diff --git a/www/wwwoffle/PLIST b/www/wwwoffle/PLIST
index 4fa3ee2fcaa..8179594960e 100644
--- a/www/wwwoffle/PLIST
+++ b/www/wwwoffle/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.4 2002/08/07 09:15:43 jlam Exp $
+@comment $NetBSD: PLIST,v 1.5 2002/08/10 17:03:26 fredb Exp $
bin/wwwoffle
bin/wwwoffle-hash
bin/wwwoffle-ls
@@ -8,8 +8,6 @@ bin/wwwoffle-rm
bin/wwwoffle-tools
bin/wwwoffle-write
etc/rc.d/wwwoffled
-etc/wwwoffle/wwwoffle.conf.install
-@exec if [ ! -f ${PKG_SYSCONFDIR}/wwwoffle/wwwoffle.conf ]; then cp -p ${PKG_SYSCONFDIR}/wwwoffle/wwwoffle.conf.install ${PKG_SYSCONFDIR}/wwwoffle/wwwoffle.conf; fi
libdata/wwwoffle-spool.tar.gz
man/man1/wwwoffle.1
man/man5/wwwoffle.conf.5
@@ -61,6 +59,7 @@ share/doc/wwwoffle/pl/INSTALL
share/doc/wwwoffle/pl/LSM
share/doc/wwwoffle/pl/README.1st
share/doc/wwwoffle/pl/README.lang
+share/examples/wwwoffle.conf
@unexec rmdir %D/share/doc/wwwoffle/ru 2>/dev/null || true
@dirrm share/doc/wwwoffle/pl
@unexec rmdir %D/share/doc/wwwoffle/nl 2>/dev/null || true
diff --git a/www/wwwoffle/files/wwwoffled b/www/wwwoffle/files/wwwoffled
index eabf7305b8e..7bb72402af9 100644
--- a/www/wwwoffle/files/wwwoffled
+++ b/www/wwwoffle/files/wwwoffled
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: wwwoffled,v 1.3 2002/08/07 09:15:44 jlam Exp $
+# $NetBSD: wwwoffled,v 1.4 2002/08/10 17:03:27 fredb Exp $
#
# PROVIDE: wwwoffled
# REQUIRE: DAEMON network
@@ -12,8 +12,8 @@ fi
name="wwwoffled"
command="@PREFIX@/sbin/${name}"
control_prog="@PREFIX@/bin/wwwoffle"
-command_args="-c @PREFIX@/etc/wwwoffle/wwwoffle.conf"
-required_files="@PREFIX@/etc/wwwoffle/wwwoffle.conf"
+command_args="-c @PKG_SYSCONFDIR@/wwwoffle.conf"
+required_files="@PKG_SYSCONFDIR@/wwwoffle.conf"
start_cmd=wwwoffled_start
stop_cmd="${control_prog} ${command_args} -kill"
autodial_cmd="${control_prog} -autodial ${command_args}"