blob: c96398cb936b10b97a20680639b93a2c875e59d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/bin/sh
#
# $NetBSD: INSTALL,v 1.4 2002/11/08 15:34:21 fredb Exp $
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
if [ ! -d "${CONFDIR}" ]
then
mkdir -p "${CONFDIR}"
fi
# 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
if [ -e "${PKG_PREFIX}/etc/wwwoffle.conf" ]
then
conf_candidates="${PKG_PREFIX}/etc/wwwoffle.conf"
fi
if [ -e /etc/wwwoffle.conf ]
then
conf_candidates="$conf_candidates /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" files.
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 installed 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; 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
|