2 # config script for webalizer
4 # see: dh_installdeb(1)
8 # bogus - though necessary - rule
9 .
/usr
/share
/debconf
/confmodule
13 configure|reconfigure
)
14 if [ "$2" ] && dpkg
--compare-versions $2 lt
2.01.6-1; then
15 db_input high webalizer
/upgrading || true
19 if [ "$2" ] && dpkg
--compare-versions $2 lt
2.01.10-30; then
20 db_input high webalizer
/upgrade2011030 || true
24 if [ -f "/etc/webalizer.conf" ] && [ ! -f "/etc/webalizer/webalizer.conf" ]; then
25 [ -d /etc
/webalizer
/ ] || mkdir
/etc
/webalizer
/;
26 mv /etc
/webalizer.conf
/etc
/webalizer
/webalizer.conf
;
29 conffile
="/etc/webalizer/webalizer.conf"
33 if [ -f $conffile ]; then
34 # parse existing configuration. This code happily
35 # concatenates multiple occurences of a configuration item,
36 # but that should never occur <frank@debian.org>.
37 OUTPUTDIR
=`sed -ne '/^OutputDir/ {s@OutputDir[[:space:]]\([^[:space:]]*\)@\1@;p}' $conffile`
38 REPORTTITLE
=`sed -ne '/^ReportTitle/ {s@ReportTitle[[:space:]]\([^[:space:]]*\)@\1@;p}' $conffile`
39 LOGFILE
=`sed -ne '/^LogFile/ {s@LogFile[[:space:]]\([^[:space:]]*\)@\1@;p}' $conffile`
41 # assign default values
42 [ -n "$OUTPUTDIR" ] || OUTPUTDIR
="/var/www/webalizer"
43 [ -n "$REPORTTITLE" ] || REPORTTITLE
="Usage statistics for"
44 if [ -z "$LOGFILE" ]; then
46 if [ -f /var
/log
/apache
2/access.log
.1 ] ||
[ -f /var
/log
/apache
2/access.log
]; then
47 LOGFILE
="/var/log/apache2/access.log.1";
49 LOGFILE
="/var/log/apache/access.log.1";
53 # now preseed the debconf questions with what we found
54 db_set webalizer
/directory
"$OUTPUTDIR" || true
55 db_set webalizer
/doc_title
"$REPORTTITLE" || true
56 db_set webalizer
/logfile
"$LOGFILE" || true
58 # Ask for the directory the output should be put in
59 db_input medium webalizer
/directory || true
62 # At this point, ask the user what the title of webalizer's reports should be
63 db_input medium webalizer
/doc_title || true
66 # Ask for the rotated logfile
67 # by default is access log file of apache, but if I found apache2 log file,
68 # I changed default to this one.
69 db_input medium webalizer
/logfile || true
72 # Ask for enable DNSCache option
73 db_input medium webalizer
/dnscache || true
77 echo "config called with unknown argument \`$1'" >&2;
82 # dh_installdeb will replace this with shell code automatically
83 # generated by other debhelper scripts.