root/alternc-awstats/tags/0.5.1/debian/postinst

Revision 1866, 2.7 kB (checked in by root, 1 year ago)

Debian compliance (lintian don't shout anymore)
Correctly depends on php5-cli or php4-cli (in #! php scripts)

  • 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
2
3 set -e
4
5 # Uses debconf
6 . /usr/share/debconf/confmodule
7
8 CONFIGFILE="/etc/alternc/local.sh"
9 MENUFILE="/etc/alternc/menulist.txt"
10 APACHEROTATE="/etc/logrotate.d/apache"
11
12 # Add awstats include to the apache configuration file given as argument
13 # function configure {
14 #     if ! grep -Eq "\*\*\*AWSTATS\*\*\*" $1; then
15 #       cp -a -f $1 $1.tmp
16 #       sed -e "s/\*\*\*ALTERNC_ALIASES\*\*\*/&\\
17 #           # ***AWSTATS*** \\
18 #       Include \"\/etc\/apache\/alternc-awstats.conf\"/" < $1 > $1.tmp
19 #       mv -f $1.tmp $1
20 #     fi
21 # }
22 # Configure logrotate.d/apache to create log owned by group www-data :
23 function logrotate_apache {
24         cp -a -f $APACHEROTATE $APACHEROTATE.tmp
25         sed -e 's/create 640 root adm/create 640 root www-data/' < $APACHEROTATE > $APACHEROTATE.tmp
26         mv -f $APACHEROTATE.tmp $APACHEROTATE
27 }
28
29 case "$1" in
30   configure)
31     . "$CONFIGFILE"
32
33     # Then, configure the quota for "aws"
34     db_get alternc-awstats/default_quota_value || true
35     /usr/lib/alternc/quota_init aws $RET
36
37     db_stop
38
39     echo "Installing mysql table"
40     mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" \
41         </usr/share/alternc/awstats.sql || true
42    
43     # Refresh apache configuration
44     # configure /etc/alternc/templates/apache/httpd.conf
45     # configure /etc/alternc/templates/apache-ssl/httpd.conf
46
47     if [ ! -h /etc/apache/conf.d/alterncawstats.conf ]; then
48         ln -sf /etc/alternc/alterncawstats.conf \
49             /etc/apache/conf.d/alterncawstats.conf
50     fi
51
52     if [ ! -h /etc/apache-ssl/conf.d/alterncawstats.conf ]; then
53         ln -sf /etc/alternc/alterncawstats.conf \
54             /etc/apache-ssl/conf.d/alterncawstats.conf
55     fi
56
57    
58     if [ ! -h /var/alternc/cgi-bin/awstats.pl ]; then
59         ln -sf /usr/lib/cgi-bin/awstats.pl \
60             /var/alternc/cgi-bin/awstats.pl
61     fi
62     alternc.install
63
64     logrotate_apache
65     # Process the language compilation.
66     /usr/share/alternc/install/dopo.sh
67    
68     # Add htpasswd :
69     touch /etc/alternc/awstats.htpasswd
70     chown www-data /etc/alternc/awstats.htpasswd /etc/awstats
71     chmod 644 /etc/alternc/awstats.htpasswd
72     chmod 755 /etc/awstats
73     mkdir -p /var/cache/awstats
74     chown www-data:www-data /var/cache/awstats
75
76     # ADD menu item :
77     if ! grep -q "^menu_aws.php$" "$MENUFILE"; then
78         rm -f $MENUFILE.alternc_awstats
79         sed -e "s/menu_brouteur.php/&\\
80 menu_aws.php/" <$MENUFILE >$MENUFILE.alternc_awstats
81         mv -f $MENUFILE.alternc_awstats $MENUFILE
82     fi
83     ;;
84
85   abort-upgrade|abort-remove|abort-deconfigure)
86     ;;
87
88   *)
89     echo "postinst called with unknown argument \`$1'" >&2
90     exit 1
91     ;;
92 esac
93
94 # dh_installdeb will replace this with shell code automatically
95 # generated by other debhelper scripts.
96 #DEBHELPER#
97
98 # vim: et sw=4
99
Note: See TracBrowser for help on using the browser.