| 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 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 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 |
|
|---|
| 45 |
|
|---|
| 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 |
|
|---|
| 66 |
/usr/share/alternc/install/dopo.sh |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|