| 1 | #!/bin/sh -e |
|---|
| 2 | |
|---|
| 3 | # Debian alternc-webalizer postinst |
|---|
| 4 | |
|---|
| 5 | # Uses debconf |
|---|
| 6 | . /usr/share/debconf/confmodule |
|---|
| 7 | # Uses AlternC.conf |
|---|
| 8 | . /etc/alternc/local.sh |
|---|
| 9 | |
|---|
| 10 | # Configure logrotate.d/apache to create log owned by group www-data : |
|---|
| 11 | function logrotate_apache { |
|---|
| 12 | cp -a -f $APACHEROTATE $APACHEROTATE.tmp |
|---|
| 13 | sed -e 's/create 640 root adm/create 640 root www-data/' < $APACHEROTATE > $APACHEROTATE.tmp |
|---|
| 14 | mv -f $APACHEROTATE.tmp $APACHEROTATE |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | case "$1" in |
|---|
| 19 | configure) |
|---|
| 20 | |
|---|
| 21 | # 1st, configure the table if required |
|---|
| 22 | mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" </usr/share/alternc/webalizer.sql || true |
|---|
| 23 | |
|---|
| 24 | # Then, configure the quota for "stats" |
|---|
| 25 | db_get alternc-webalizer/default_quota_value || true |
|---|
| 26 | /usr/lib/alternc/quota_init stats $RET |
|---|
| 27 | |
|---|
| 28 | # stop debconf so the output of dopo doesn't screw up something |
|---|
| 29 | db_stop |
|---|
| 30 | |
|---|
| 31 | # Compile the po files : |
|---|
| 32 | /usr/share/alternc/install/dopo.sh |
|---|
| 33 | |
|---|
| 34 | chown www-data /var/cache/alternc-webalizer |
|---|
| 35 | |
|---|
| 36 | logrotate_apache |
|---|
| 37 | |
|---|
| 38 | # ADD menu item : |
|---|
| 39 | |
|---|
| 40 | if ! grep -q "^menu_webalizer.php$" "$MENUFILE"; then |
|---|
| 41 | rm -f $MENUFILE.alternc_webalizer |
|---|
| 42 | sed -e "s/menu_brouteur.php/&\\ |
|---|
| 43 | menu_webalizer.php/" <$MENUFILE >$MENUFILE.alternc_webalizer |
|---|
| 44 | mv -f $MENUFILE.alternc_webalizer $MENUFILE |
|---|
| 45 | fi |
|---|
| 46 | |
|---|
| 47 | ;; |
|---|
| 48 | |
|---|
| 49 | abort-upgrade) |
|---|
| 50 | exit 0 |
|---|
| 51 | ;; |
|---|
| 52 | |
|---|
| 53 | abort-remove|abort-deconfigure) |
|---|
| 54 | exit 0 |
|---|
| 55 | ;; |
|---|
| 56 | |
|---|
| 57 | *) |
|---|
| 58 | echo "postinst called with unknown argument '$1'" >&2 |
|---|
| 59 | exit 1 |
|---|
| 60 | ;; |
|---|
| 61 | esac |
|---|
| 62 | |
|---|
| 63 | # dh_installdeb will replace this with shell code automatically |
|---|
| 64 | # generated by other debhelper scripts. |
|---|
| 65 | |
|---|
| 66 | #DEBHELPER# |
|---|
| 67 | |
|---|
| 68 | exit 0 |
|---|