source: trunk/debian/postinst @ 1070

Revision 1070, 2.1 KB checked in by anarcat, 7 years ago (diff)

try to make this installable, by fixing the following error:

chown: cannot access `/var/cache/awstats': No such file or directory

  • 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    # Finally, add this module to the AlternC's menu :
56    if [ -z `grep menu_aws.php /var/alternc/bureau/admin/menulist.txt` ] 
57    then
58        echo "menu_aws.php" >>/var/alternc/bureau/admin/menulist.txt
59        echo "you may move menu_aws.php to a better place in /var/alternc/bureau/admin/menulist.txt"
60    fi
61
62    ;;
63
64abort-upgrade)
65    exit 0
66    ;;
67
68abort-remove|abort-deconfigure)
69    exit 0
70    ;;
71
72*)
73    echo "postinst called with unknown argument '$1'" >&2
74    exit 1
75    ;;
76esac
77
78# dh_installdeb will replace this with shell code automatically
79# generated by other debhelper scripts.
80
81#DEBHELPER#
82
83exit 0
Note: See TracBrowser for help on using the repository browser.