source: trunk/debian/postinst @ 1067

Revision 1067, 2.4 KB checked in by benjamin, 7 years ago (diff)

correction bug /var/cache/awstats not found on postinst (empty folder)

  • 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-awstats postinst
4# Benjamin Sonntag <benjamin@alternc.org>
5
6# Cette fonction regarde si un fichier de config ($1) a déjà reçu une modif
7# de config, et sinon, lui ajoute la ligne voulue là où la balise le demande.
8function configure {
9    if grep -vqs "\*\*\*AWSTATS\*\*\*" $1
10        then
11        # 1. on déplace le fichier
12        rm -f $1.alternc_awstats
13        sed -e "s/\*\*\*ALTERNC_ALIASES\*\*\*/&\\
14        # ***AWSTATS*** \\
15        Include \"\/etc\/apache\/alternc-awstats.conf\"/" <$1 >$1.alternc_awstats
16        mv -f $1.alternc_awstats $1
17    fi
18}
19
20
21# Uses debconf
22. /usr/share/debconf/confmodule
23# Uses AlternC.conf
24if [ -e /etc/alternc/local.sh ] 
25then
26    . /etc/alternc/local.sh
27fi
28
29case "$1" in
30configure)
31        ## for older alternc version
32    if [ -z "$MYSQL_HOST" ]
33        then
34        MYSQL_HOST="localhost"
35    fi
36    # 1st, configure the table if required
37    mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" </usr/share/alternc/awstats.sql || true
38
39    # Then, configure the quota for "stats"
40    RET="2"
41    db_get alternc-awstats/default_quota_value
42    /usr/lib/alternc/quota_init aws $RET
43
44    # Compile the po files :
45    echo "Configuring apache"
46    configure /etc/apache/httpd.conf
47    configure /usr/share/alternc/1.0/install/etc/apache-ssl/httpd.conf
48    echo "Configuring apache-ssl"
49    configure /etc/apache-ssl/httpd.conf
50    configure /usr/share/alternc/1.0/install/etc/apache/httpd.conf
51    /usr/share/alternc/install/dopo.sh || true
52    /etc/init.d/apache reload || true
53    ln /usr/lib/cgi-bin/awstats.pl /var/alternc/cgi-bin/ -sf
54
55    # that's not very nice, but we need it
56    mkdir /var/cache/awstats
57    chown www-data /etc/awstats /var/cache/awstats
58    touch /etc/alternc/awstats.htpasswd
59    chown 33 /etc/alternc/awstats.htpasswd
60    chmod 777 /etc/alternc/awstats.htpasswd
61
62    # Finally, add this module to the AlternC's menu :
63    if [ -z `grep menu_aws.php /var/alternc/bureau/admin/menulist.txt` ] 
64    then
65        echo "menu_aws.php" >>/var/alternc/bureau/admin/menulist.txt
66        echo "you may move menu_aws.php to a better place in /var/alternc/bureau/admin/menulist.txt"
67    fi
68
69    ;;
70
71abort-upgrade)
72    exit 0
73    ;;
74
75abort-remove|abort-deconfigure)
76    exit 0
77    ;;
78
79*)
80    echo "postinst called with unknown argument '$1'" >&2
81    exit 1
82    ;;
83esac
84
85# dh_installdeb will replace this with shell code automatically
86# generated by other debhelper scripts.
87
88#DEBHELPER#
89
90exit 0
Note: See TracBrowser for help on using the repository browser.