root/alternc-webalizer/trunk/debian/postinst

Revision 2177, 1.6 kB (checked in by anarcat, 7 months ago)

correctly declare functions

I forgot to mention that the original patch here is from Patrick Hétu.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/bin/sh -e
2
3 # Debian alternc-webalizer postinst
4
5 # Uses debconf
6 . /usr/share/debconf/confmodule
7 # Uses AlternC.conf
8 . /etc/alternc/local.sh
9
10 APACHEROTATE=/etc/logrotate.d/apache
11 MENUFILE=/etc/alternc/menulist.txt
12
13 # Configure logrotate.d/apache to create log owned by group www-data :
14 logrotate_apache() {
15         cp -a -f $APACHEROTATE $APACHEROTATE.tmp
16         sed -e 's/create 640 root adm/create 640 root www-data/' < $APACHEROTATE > $APACHEROTATE.tmp
17         mv -f $APACHEROTATE.tmp $APACHEROTATE
18 }
19
20
21 case "$1" in
22 configure)
23
24     # 1st, configure the table if required
25     mysql --defaults-file=/etc/alternc/my.cnf </usr/share/alternc/webalizer.sql || true
26
27     # Then, configure the quota for "stats"
28     db_get alternc-webalizer/default_quota_value || true
29     /usr/lib/alternc/quota_init stats $RET
30
31     # stop debconf so the output of dopo doesn't screw up something
32     db_stop
33
34     # Compile the po files :
35     /usr/share/alternc/install/dopo.sh
36
37     chown www-data /var/cache/alternc-webalizer
38    
39     logrotate_apache
40
41     # ADD menu item :
42     
43     if ! grep -q "^menu_webalizer.php$" "$MENUFILE"; then
44         rm -f $MENUFILE.alternc_webalizer
45         sed -e "s/menu_sta2.php/&\\
46 menu_webalizer.php/" <$MENUFILE >$MENUFILE.alternc_webalizer
47         mv -f $MENUFILE.alternc_webalizer $MENUFILE
48     fi
49
50     ;;
51
52 abort-upgrade)
53     exit 0
54     ;;
55
56 abort-remove|abort-deconfigure)
57     exit 0
58     ;;
59
60 *)
61     echo "postinst called with unknown argument '$1'" >&2
62     exit 1
63     ;;
64 esac
65
66 # dh_installdeb will replace this with shell code automatically
67 # generated by other debhelper scripts.
68
69 #DEBHELPER#
70
71 exit 0
Note: See TracBrowser for help on using the browser.