| 1 |
#!/bin/sh |
|---|
| 2 |
|
|---|
| 3 |
set -e |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 44 |
configure /etc/alternc/templates/apache/httpd.conf |
|---|
| 45 |
configure /etc/alternc/templates/apache-ssl/httpd.conf |
|---|
| 46 |
ln /usr/lib/cgi-bin/awstats.pl /var/alternc/cgi-bin/ -sf |
|---|
| 47 |
alternc.install |
|---|
| 48 |
|
|---|
| 49 |
logrotate_apache |
|---|
| 50 |
|
|---|
| 51 |
/usr/share/alternc/install/dopo.sh |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
touch /etc/alternc/awstats.htpasswd |
|---|
| 55 |
chown www-data /etc/alternc/awstats.htpasswd /etc/awstats |
|---|
| 56 |
chmod 644 /etc/alternc/awstats.htpasswd |
|---|
| 57 |
chmod 755 /etc/awstats |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
if ! grep -q "^menu_aws.php$" "$MENUFILE"; then |
|---|
| 61 |
rm -f $MENUFILE.alternc_awstats |
|---|
| 62 |
sed -e "s/menu_brouteur.php/&\\ |
|---|
| 63 |
menu_aws.php/" <$MENUFILE >$MENUFILE.alternc_awstats |
|---|
| 64 |
mv -f $MENUFILE.alternc_awstats $MENUFILE |
|---|
| 65 |
fi |
|---|
| 66 |
;; |
|---|
| 67 |
|
|---|
| 68 |
abort-upgrade|abort-remove|abort-deconfigure) |
|---|
| 69 |
;; |
|---|
| 70 |
|
|---|
| 71 |
*) |
|---|
| 72 |
echo "postinst called with unknown argument \`$1'" >&2 |
|---|
| 73 |
exit 1 |
|---|
| 74 |
;; |
|---|
| 75 |
esac |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|