aboutsummaryrefslogtreecommitdiffstats
path: root/debian/sitesummary.postinst
blob: e720788d0e124b34a2a222c6272698353273d989 (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
#!/bin/sh

set -e

# Source debconf library.
. /usr/share/debconf/confmodule

case "$1" in
    configure)

        # Adjust to the new config location, in
        # /etc/apache2/conf.d/sitesummary
	if [ -f /etc/apache2/sites-available/sitesummary ] ; then
	    if [ -f /etc/apache2/sites-enabled//sitesummary ] &&
		[ -x /usr/sbin/a2dissite ] ; then
		a2dissite sitesummary
	    fi
	    rm /etc/apache2/sites-available/sitesummary
	fi

        # Make sure the cgi script can write to the storage area
	chown www-data /var/lib/sitesummary/tmpstorage \
	    /var/lib/sitesummary/entries 

        # If the config file is missing, check debconf to see if the
        # munin configuration feature should be enabled.  This hidden
        # debconf question allow preseeding during installation.
	config=/etc/sitesummary/collector.cfg
	if [ ! -f $config ] ; then
	    db_get sitesummary/replace-munin-config
	    if [ true = "$RET" ] ; then
		echo 'MUNINDIR=/etc/munin' > $config
	    fi
	fi

        # Generate the web page at install time
	[ -f /var/lib/sitesummary/www/index.html ] || \
	    /etc/cron.daily/sitesummary

	;;

    abort-upgrade|abort-remove|abort-deconfigure)

	;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0