X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=webalizer-cn.git;a=blobdiff_plain;f=debian%2Fpostinst;h=2203c52a1bb0ffb4ea2f58aab19918434e30f877;hp=6d76d60d39ca064986ee80f9e0f37273495313d7;hb=b668a392de1229c0c4598597ad0c71ac82e13782;hpb=1b2bd59b9fb3ddc7ce19b3eff34213e6ca3cd51a diff --git a/debian/postinst b/debian/postinst index 6d76d60..2203c52 100755 --- a/debian/postinst +++ b/debian/postinst @@ -35,6 +35,8 @@ WCONFBAK=`basename $WCONF` oldreporttitle="usage statistics for" reporttitle="Statistika pristupa za" +customized=0 +need_restart=0 if [ -f "$WCONF" ]; then @@ -46,7 +48,9 @@ if [ -f "$WCONF" ]; then # Check for OutputDir temp=`awk 'tolower($1) == "outputdir" { print $2; }' $WCONF | tail -n 1` if [ "$temp" != "$WDIR" ]; then + cp_echo "CN: Found custom OutputDir value: $temp" db_set webalizer/directory "$temp" || true + customized=1 fi # Check for ReportTitle @@ -58,9 +62,11 @@ if [ -f "$WCONF" ]; then "s/$temp_re/ReportTitle ${reporttitle}/I" \ "$WCONF" || true db_set webalizer/doc_title "$reporttitle" || true + need_restart=1 fi else cp_echo "CN: Configuration file $WCONF is missing." + customized=1 fi db_stop || true @@ -68,26 +74,34 @@ db_stop || true # Check Apache2 web server configuration and reload Apache2 web server. # -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!" +if [ $need_restart -eq 1 ]; then + 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!" + fi 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." +if [ $customized -eq 0 ]; then + 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." + else + cp_echo "CN: File $WHTPASSWD already exists." + fi +else + cp_echo "CN: Skipping file $WHTPASSWD" fi # Mail root.