Upgrade paketa za Debian lenny.
authorDragan Dosen <bane@nekkar.carnet.hr>
Sun, 19 Apr 2009 15:45:32 +0000 (17:45 +0200)
committerDragan Dosen <bane@nekkar.carnet.hr>
Sun, 19 Apr 2009 15:45:32 +0000 (17:45 +0200)
Inicijalna zaporka (admin korisnik) za pristup Webalizer web
stranicama je duljine 8 znakova, te je zapisana u .htpasswd
datoteku koristeci MD5 enkripciju.

Paket vise ne ovisi o paketima apache-common i perl.

debian/changelog.CARNet
debian/control
debian/postinst
debian/prerm

index 237bc2d..ae587d2 100644 (file)
@@ -1,3 +1,13 @@
+webalizer-cn (2.01.10-32.4) stable; urgency=low
+
+  * Upgrade paketa za Debian lenny.
+  * Inicijalna zaporka (admin korisnik) za pristup Webalizer web
+    stranicama je duljine 8 znakova, te je zapisana u .htpasswd
+    datoteku koristeci MD5 enkripciju.
+  * Paket vise ne ovisi o paketima apache-common i perl.
+
+ -- Dragan Dosen <ddosen@ffzg.hr>  Sat, 18 Apr 2009 22:57:20 +0200
+
 webalizer-cn (2.01.10-32) stable; urgency=low
 
   * Prva inacica paketa za Debian etch distribuciju.
 webalizer-cn (2.01.10-32) stable; urgency=low
 
   * Prva inacica paketa za Debian etch distribuciju.
index ad40d25..690fff7 100644 (file)
@@ -1,16 +1,15 @@
 Source: webalizer-cn
 Section: web
 Source: webalizer-cn
 Section: web
-Origin: carnet
 Priority: optional
 Maintainer: Dragan Dosen <ddosen@ffzg.hr>
 Build-Depends: debhelper (>= 4.0.0)
 Priority: optional
 Maintainer: Dragan Dosen <ddosen@ffzg.hr>
 Build-Depends: debhelper (>= 4.0.0)
-Standards-Version: 3.6.1
+Standards-Version: 3.7.2
 
 Package: webalizer-cn
 Architecture: all
 Pre-Depends: apache2-cn (>= 2.2)
 
 Package: webalizer-cn
 Architecture: all
 Pre-Depends: apache2-cn (>= 2.2)
-Depends: webalizer (>= 2.01.10-32), apache-common (>= 1.3.29), makepasswd, carnet-tools-cn (>= 2.0), perl (>= 5.8.4-2)
-Description: web server log analysis program
+Depends: webalizer (>= 2.01.10-32.4), makepasswd, carnet-tools-cn (>= 2.8.1), ${misc:Depends}
+Description: web server log analysis program (CARNet configuration)
  The Webalizer was designed to scan web server log files in various formats
  and produce usage statistics in  HTML format for viewing through a browser.
  The Webalizer produces yearly, monthly, daily and hourly statistics. In the
  The Webalizer was designed to scan web server log files in various formats
  and produce usage statistics in  HTML format for viewing through a browser.
  The Webalizer produces yearly, monthly, daily and hourly statistics. In the
@@ -23,4 +22,3 @@ Description: web server log analysis program
  Homepage: http://www.mrunix.net/webalizer/
  .
  This package provides CARNet configuration for Webalizer.
  Homepage: http://www.mrunix.net/webalizer/
  .
  This package provides CARNet configuration for Webalizer.
-
index a3b3604..93fc429 100755 (executable)
 #!/bin/sh
 
 #!/bin/sh
 
-[ "$1" = "configure" ] || exit 0
-[ "$DEBIAN_SCRIPT_DEBUG" ] && set -x
+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
+       ;;
+esac
 
 
-# Load CARNet Tools
-. /usr/share/carnet-tools/functions.sh
 
 
-# Debconf
+# Load debconf
 . /usr/share/debconf/confmodule
 
 . /usr/share/debconf/confmodule
 
-# Get some useful functions (apache-common)
-. /usr/share/apache/postinst.common
+# Include CARNet functions
+. /usr/share/carnet-tools/functions.sh
 
 
-dir=/var/www/webalizer
-htpasswd=$dir/.htpasswd
-CONF=/etc/webalizer/webalizer.conf
-BACKUPDIR=/var/backups
-CONFBAK=$BACKUPDIR/`basename $CONF`.bak
+PKG="webalizer-cn"
+WDIR="/var/www/webalizer"
+WHTPASSWD="$WDIR/.htpasswd"
+WCONF="/etc/webalizer/webalizer.conf"
+WCONFBAK=`basename $WCONF`
 oldreporttitle="Usage Statistics for"
 reporttitle="Statistika pristupa za"
 
 
 oldreporttitle="Usage Statistics for"
 reporttitle="Statistika pristupa za"
 
 
-# Check if there is some old webalizer-cn.conf file in Apache 1.x conf.d directory  -ddosen
-if [ -f "/etc/apache/conf.d/webalizer-cn.conf" ]; then
-       if ! cmp -s "/etc/apache/conf.d/webalizer-cn.conf" "/etc/apache2/conf.d/webalizer-cn.conf"; then
-               mv /etc/apache/conf.d/webalizer-cn.conf /etc/apache2/conf.d/webalizer-cn.conf
+if [ -f "$WCONF" ]; then
+
+       # Backup first.
+       if cp_check_and_backup "$WCONFBAK"; then
+               cp_echo "CN: Old $WCONF saved as \"/var/backups/$WCONFBAK.bak\"."
        fi
        fi
-fi
 
 
-temp=`pget $CONF OutputDir |tail -n 1|awk '{print $NF}'`
-if [ "$temp" != "$dir" ]; then
-       #cp_echo "CN: Found custom OutputDir value: $temp, not touching anything!"
-       db_set webalizer/directory "$temp" || true
-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
 
 
-# Customise ReportTitle
-temp=`pget $CONF ReportTitle |tail -n 1|perl -pe 's/(ReportTitle\s+?)(.*$)/$2/'`
-if [ "$temp" = "$oldreporttitle" ]; then
-       pset $CONF ReportTitle "$reporttitle"
-       db_set webalizer/doc_title "$reporttitle" || true
+       # Check for ReportTitle
+       temp=`awk 'tolower($1) == "reporttitle" { for(i=2; i<NF; i++) printf("%s ", $i); print $(NF) }' $WCONF | tail -n 1`
+       if [ "$temp" = "$oldreporttitle" ]; then
+
+               temp_re="^[[:space:]]*ReportTitle[[:space:]]*${oldreporttitle}$"
+               cp_check_and_sed "." \
+                       "s/$temp_re/ReportTitle ${reporttitle}/I" \
+                       "$WCONF" || true
+               db_set webalizer/doc_title "$reporttitle" || true
+       fi
+else
+       cp_echo "CN: Configuration file $WCONF is missing."
 fi
 
 fi
 
-db_stop
+db_stop || true
+
+
+# Check Apache2 web server configuration and reload Apache2 web server.
+#
+if /usr/sbin/apache2ctl configtest 2>/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
+else
 
 
-# Reload Apache2 web server
-if [ -x /etc/init.d/apache2 ]; then
-       /etc/init.d/apache2 reload || true
+       # Something is broken.
+       cp_echo "CN: Your Apache2 configuration is broken."
+       cp_echo "CN: Please, check the service after the installation finishes!"
 fi
 
 fi
 
-# Send mail with informations
-if [ ! -f $htpasswd ]; then
-       passwd=`makepasswd`
-       htpasswd -bc $htpasswd admin $passwd 2> /dev/null
+
+# 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 ""
        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 $htpasswd admin\" to change it."
-       cp_mail "webalizer-cn"
+       cp_echo "CN: Use \"htpasswd -m $WHTPASSWD admin\" to change it."
 fi
 fi
+
+
+# Mail root.
+#
+cp_mail "$PKG"
+
+exit 0
index 2fec6c6..7b80a4d 100755 (executable)
@@ -2,7 +2,20 @@
 
 set -e
 
 
 set -e
 
-[ "$1" = "remove" ] || exit 0
+case "$1" in
+       remove|deconfigure)
+       ;;
+
+       upgrade)
+       ;;
+
+       failed-upgrade)
+       ;;
+
+       *)
+       echo "prerm called with unknown argument \$1'" >&2
+       exit 0
+       ;;
+esac
 
 
-# Placeholder    
 exit 0
 exit 0