2 # postinst script for webalizer
4 # see: dh_installdeb(1)
8 # summary of how this script can be called:
9 # * <postinst> `configure' <most-recently-configured-version>
10 # * <old-postinst> `abort-upgrade' <new version>
11 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
13 # * <postinst> `abort-remove'
14 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15 # <failed-install-package> <version> `removing'
16 # <conflicting-package> <version>
17 # for details, see http://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
21 # bogus - though necessary - rule
22 .
/usr
/share
/debconf
/confmodule
27 db_get webalizer
/directory || true
29 if [ -z "$OUTPUTDIR" ]; then
30 echo "Fatal: No ouptut dir given, not creating webalizer configuration" >&2
33 if [ ! -d $OUTPUTDIR ]; then
34 if mkdir
-p $OUTPUTDIR; then
35 echo "$OUTPUTDIR created" >&2
37 echo "Something went wrong..." >&2
43 db_get webalizer
/doc_title || true
46 db_get webalizer
/logfile || true
49 db_get webalizer
/dnscache || true
52 # create conffile if it doesn't exist yet
53 conffile
="/etc/webalizer/webalizer.conf"
54 template_gz
=/usr
/share
/doc
/webalizer
/examples
/sample.conf.gz
55 if [ ! -f $conffile ]; then
56 zcat
$template_gz > $conffile
57 WEBHOSTNAME
=$
(hostname
)
58 # uncomment the debconf-handled items
60 -e "s/^#HostName .*/HostName ${WEBHOSTNAME}/" \
61 -e "s/^#OutputDir /OutputDir /" \
62 -e "s/^#ReportTitle /ReportTitle/" \
63 -e "s/^#LogFile /LogFile /" \
67 # Finally put these variables in /etc/webalizer/webalizer.conf using sed
69 -e "s|^OutputDir .*|OutputDir ${OUTPUTDIR}|" \
70 -e "s/^ReportTitle .*/ReportTitle ${REPORTTITLE}/" \
71 -e "s|^LogFile .*|LogFile ${LOGFILE}|" \
74 # Enable DNSCache Option
75 if [ "$DNSCACHE" = "true" ]; then
77 -e "s/^#DNSCache /DNSCache /" \
78 -e "s/^#DNSChildren .*/DNSChildren 10/" \
83 abort-upgrade|abort-remove|abort-deconfigure
)
88 echo "postinst called with unknown argument \`$1'" >&2
93 # dh_installdeb will replace this with shell code automatically
94 # generated by other debhelper scripts.