X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=webalizer-cn.git;a=blobdiff_plain;f=debian%2Fpostinst;h=6d76d60d39ca064986ee80f9e0f37273495313d7;hp=c4fca829cebd3e506892dc7f3e88080fd4754fee;hb=1b2bd59b9fb3ddc7ce19b3eff34213e6ca3cd51a;hpb=d44cbb4cf6ac73c9a82aa1e00b9b5e6a7739d98e diff --git a/debian/postinst b/debian/postinst index c4fca82..6d76d60 100755 --- a/debian/postinst +++ b/debian/postinst @@ -5,23 +5,24 @@ set -e [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx case "$1" in - configure) - # continue below - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - exit 0 - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 0 - ;; + configure) + # continue below + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; esac # Load debconf . /usr/share/debconf/confmodule +db_version 2.0 # Include CARNet functions . /usr/share/carnet-tools/functions.sh @@ -37,30 +38,29 @@ reporttitle="Statistika pristupa za" if [ -f "$WCONF" ]; then - # Backup first. - if cp_check_and_backup "$WCONF"; then - cp_echo "CN: Old $WCONF saved as \"/var/backups/$WCONFBAK.bak\"." - fi - - # Check for OutputDir - temp=`awk 'tolower($1) == "outputdir" { print $2; }' $WCONF | tail -n 1` - if [ "$temp" != "$WDIR" ]; then - db_set webalizer/directory "$temp" || true - fi - - # Check for ReportTitle - temp=`awk 'tolower($1) == "reporttitle" { for(i=2; i/dev/null; then - - # Reload Apache2 web server. - if [ -x "/etc/init.d/apache2" ]; then - if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then - invoke-rc.d apache2 reload || true - else - /etc/init.d/apache2 reload || true - fi - fi +if apache2ctl configtest 2>/dev/null; then + invoke-rc.d apache2 force-reload || true else - - # Something is broken. - cp_echo "CN: Your Apache2 configuration is broken." - cp_echo "CN: Please, check the service after the installation finishes!" + # Something is broken. + cp_echo "CN: Your Apache2 configuration is broken." + cp_echo "CN: Please, check the service after the installation finishes!" fi # Generate e-mail message with informations (username and password). # if [ ! -f "$WHTPASSWD" ]; then - passwd=`makepasswd --chars 8` - htpasswd -bcm $WHTPASSWD admin $passwd 2> /dev/null - cp_echo "" - cp_echo "CN: Webalizer URL is http://`hostname -f`/stats/" - cp_echo "CN: User: admin" - cp_echo "CN: Password: $passwd" - cp_echo "" - cp_echo "CN: Use \"htpasswd -m $WHTPASSWD admin\" to change it." + passwd="$(makepasswd --chars 8)" + htpasswd -bcm $WHTPASSWD admin $passwd 2> /dev/null + cp_echo "" + cp_echo "CN: Webalizer URL is http://`hostname -f`/stats/" + cp_echo "CN: User: admin" + cp_echo "CN: Password: $passwd" + cp_echo "" + cp_echo "CN: Use \"htpasswd -m $WHTPASSWD admin\" to change it." fi - # Mail root. # cp_mail "$PKG" +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + exit 0