Imported Debian patch 2.23.05-1
[hcoop/zz_old/debian/webalizer.git] / debian / config
CommitLineData
dc9c5d88
FAW
1#! /bin/sh
2# config script for webalizer
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# bogus - though necessary - rule
9. /usr/share/debconf/confmodule
10db_version 2.0
11
12case "$1" in
13 configure|reconfigure)
14 if [ "$2" ] && dpkg --compare-versions $2 lt 2.01.6-1; then
15 db_input high webalizer/upgrading || true
16 db_go
17 fi
18
19 if [ "$2" ] && dpkg --compare-versions $2 lt 2.01.10-30; then
20 db_input high webalizer/upgrade2011030 || true
21 db_go
22 fi
23
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;
27 fi
28
29 conffile="/etc/webalizer/webalizer.conf"
30 OUTPUTDIR=""
31 REPORTTITLE=""
32 LOGFILE=""
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`
40 fi
41 # assign default values
42 [ -n "$OUTPUTDIR" ] || OUTPUTDIR="/var/www/webalizer"
43 [ -n "$REPORTTITLE" ] || REPORTTITLE="Usage statistics for"
44 if [ -z "$LOGFILE" ]; then
45 # apache2 found?
46 if [ -f /var/log/apache2/access.log.1 ] || [ -f /var/log/apache2/access.log ]; then
47 LOGFILE="/var/log/apache2/access.log.1";
48 else
49 LOGFILE="/var/log/apache/access.log.1";
50 fi
51 fi
52
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
57
58 # Ask for the directory the output should be put in
59 db_input medium webalizer/directory || true
60 db_go
61
62 # At this point, ask the user what the title of webalizer's reports should be
63 db_input medium webalizer/doc_title || true
64 db_go
65
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
70 db_go
71
72 # Ask for enable DNSCache option
73 db_input medium webalizer/dnscache || true
74 db_go
75 ;;
76 *)
77 echo "config called with unknown argument \`$1'" >&2;
78 exit 1;
79 ;;
80esac
81
82# dh_installdeb will replace this with shell code automatically
83# generated by other debhelper scripts.
84
85exit 0
86