Prva inacica paketa za Debian jessie distribuciju.
authorDragan Dosen <Dragan.Dosen@CARNet.hr>
Tue, 3 May 2016 22:16:59 +0000 (00:16 +0200)
committerDragan Dosen <Dragan.Dosen@CARNet.hr>
Tue, 3 May 2016 22:16:59 +0000 (00:16 +0200)
debian/changelog
debian/compat
debian/control
debian/copyright
debian/install
debian/postinst
debian/postrm [new file with mode: 0755]
debian/preinst [new file with mode: 0755]
debian/prerm [new file with mode: 0755]
debian/rules
webalizer-cn.conf

index d25b3f1..0a8c584 100644 (file)
@@ -1,3 +1,14 @@
+webalizer-cn (2.23.08+1) stable; urgency=low
+
+  * Prva inacica paketa za Debian jessie distribuciju.
+  * Azurirane ovisnosti unutar debian/control.
+  * Koristi dh_apache2 za instalaciju Apache2 konfiguracije.
+  * Migracija konfiguracije za Apache2 iz /etc/apache2/conf.d/ direktorija
+    u direktorij /etc/apache2/conf-available/.
+  * Azurirane ostale debian/ datoteke.
+
+ -- Dragan Dosen <Dragan.Dosen@CARNet.hr>  Mon, 02 May 2016 15:35:24 +0200
+
 webalizer-cn (2.23.05+1) stable; urgency=low
 
   * Prva inacica paketa za Debian wheezy distribuciju.
 webalizer-cn (2.23.05+1) stable; urgency=low
 
   * Prva inacica paketa za Debian wheezy distribuciju.
index 45a4fb7..ec63514 100644 (file)
@@ -1 +1 @@
-8
+9
index a6fc252..860bdc3 100644 (file)
@@ -1,14 +1,15 @@
 Source: webalizer-cn
 Source: webalizer-cn
-Section: web
 Priority: optional
 Priority: optional
+Section: web
 Maintainer: Dragan Dosen <Dragan.Dosen@CARNet.hr>
 Maintainer: Dragan Dosen <Dragan.Dosen@CARNet.hr>
-Build-Depends: debhelper (>= 8.0.0)
-Standards-Version: 3.9.3
+Build-Depends: debhelper (>> 9), apache2-dev (>= 2.4.10)
+Standards-Version: 3.9.4
+Homepage: http://www.mrunix.net/webalizer/
 
 Package: webalizer-cn
 Architecture: all
 
 Package: webalizer-cn
 Architecture: all
-Pre-Depends: apache2-cn (>= 2.2.22+1)
-Depends: webalizer (>= 2.23.05-1), makepasswd, carnet-tools-cn (>= 3.0.4), ${misc:Depends}
+Pre-Depends: apache2-cn (>= 2.4.10+1)
+Depends: webalizer (>= 2.23.08-1), makepasswd, carnet-tools-cn (>= 3.1.0), ${misc:Depends}
 Description: web server log analysis program
  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.
 Description: web server log analysis program
  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.
@@ -20,4 +21,3 @@ Description: web server log analysis program
  program to be tailored to individual needs easily.
  .
  This package provides CARNet configuration for Webalizer.
  program to be tailored to individual needs easily.
  .
  This package provides CARNet configuration for Webalizer.
-Homepage: http://www.mrunix.net/webalizer/
index dd9254d..235dba3 100644 (file)
@@ -1,4 +1,4 @@
-Copyright 2013 CARNet
+Copyright 2013-2016 CARNet
 
 You are free to distribute this software package under the terms of the
 GNU General Public License.
 
 You are free to distribute this software package under the terms of the
 GNU General Public License.
index aa8edde..e4dde1e 100644 (file)
@@ -1 +1 @@
-webalizer-cn.conf /etc/apache2/conf.d
\ No newline at end of file
+webalizer-cn.conf /etc/apache2/conf-available
index 2203c52..9c07c04 100755 (executable)
@@ -10,12 +10,12 @@ case "$1" in
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
-    exit 0
+        exit 0
     ;;
 
     *)
     ;;
 
     *)
-    echo "postinst called with unknown argument \`$1'" >&2
-    exit 0
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 0
     ;;
 esac
 
     ;;
 esac
 
@@ -32,17 +32,53 @@ WDIR="/var/www/webalizer"
 WHTPASSWD="$WDIR/.htpasswd"
 WCONF="/etc/webalizer/webalizer.conf"
 WCONFBAK=`basename $WCONF`
 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"
-
 customized=0
 customized=0
-need_restart=0
+
+
+if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
+    . /usr/share/apache2/apache2-maintscript-helper
+
+    webalizer_enable() {
+        cp_echo "CN: Enabling $PKG configuration for Apache2."
+        return 0
+    }
+else
+    cp_echo "CN: Could not load Apache 2.4 maintainer script helper."
+
+    webalizer_enable() {
+        return 1
+    }
+fi
+
+webalizer_error() {
+    cp_echo "CN: Error while trying to enable $PKG configuration for Apache2."
+}
+
+mv_conffile()
+{
+    local oldconffile="$1"
+    local newconffile="$2"
+
+    rm -f $oldconffile.dpkg-remove
+    [ -e "$oldconffile" ] || return 0
+
+    cp_echo "CN: Preserving user changes to $newconffile (renamed from $oldconffile)."
+    mv -f "$newconffile" "$newconffile.dpkg-new"
+    mv -f "$oldconffile" "$newconffile"
+}
+
+
+mv_conffile /etc/apache2/conf.d/$PKG.conf \
+    /etc/apache2/conf-available/$PKG.conf
 
 if [ -f "$WCONF" ]; then
 
     # Backup first.
     if cp_check_and_backup "$WCONF"; then
 
 if [ -f "$WCONF" ]; then
 
     # Backup first.
     if cp_check_and_backup "$WCONF"; then
-        cp_echo "CN: Old $WCONF saved as \"/var/backups/$WCONFBAK.bak\"."
+        cp_echo "CN: Old $WCONF saved as /var/backups/$WCONFBAK.bak."
     fi
 
     # Check for OutputDir
     fi
 
     # Check for OutputDir
@@ -62,7 +98,6 @@ if [ -f "$WCONF" ]; then
             "s/$temp_re/ReportTitle    ${reporttitle}/I" \
             "$WCONF" || true
         db_set webalizer/doc_title "$reporttitle" || true
             "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."
     fi
 else
     cp_echo "CN: Configuration file $WCONF is missing."
@@ -72,19 +107,6 @@ fi
 db_stop || true
 
 
 db_stop || true
 
 
-# Check Apache2 web server configuration and reload Apache2 web server.
-#
-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 [ $customized -eq 0 ]; then
 # Generate e-mail message with informations (username and password).
 #
 if [ $customized -eq 0 ]; then
@@ -104,13 +126,15 @@ else
     cp_echo "CN: Skipping file $WHTPASSWD"
 fi
 
     cp_echo "CN: Skipping file $WHTPASSWD"
 fi
 
+#DEBHELPER#
+
+if ! apache2ctl configtest >/dev/null 2>&1; then
+    cp_echo "CN: Your Apache2 configuration seems to be broken."
+    cp_echo "CN: Please, check the service after the installation finishes!"
+fi
+
 # Mail root.
 #
 cp_mail "$PKG"
 
 # Mail root.
 #
 cp_mail "$PKG"
 
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
 exit 0
 exit 0
diff --git a/debian/postrm b/debian/postrm
new file mode 100755 (executable)
index 0000000..a447401
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+PKG="webalizer-cn"
+
+if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
+    . /usr/share/apache2/apache2-maintscript-helper
+
+    webalizer_enable() {
+        echo "CN: Purging $PKG configuration for Apache2."
+        return 0
+    }
+else
+    echo "CN: Could not load Apache 2.4 maintainer script helper."
+
+    webalizer_enable() {
+        return 1
+    }
+fi
+
+webalizer_error() {
+    echo "CN: Error while trying to purge $PKG configuration for Apache2."
+}
+
+if [ "$1" = "abort-install" ] || [ "$1" = "abort-upgrade" ]; then
+    conffile=/etc/apache2/conf.d/$PKG.conf
+
+    if [ -e "$conffile.dpkg-remove" ]; then
+        echo "CN: Reinstalling $conffile that was moved away."
+        mv "$conffile.dpkg-remove" "$conffile"
+    fi
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/preinst b/debian/preinst
new file mode 100755 (executable)
index 0000000..9b2faa1
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+PKG="webalizer-cn"
+
+prepare_mv_conffile() {
+    local conffile="$1"
+
+    [ -e "$conffile" ] || return 0
+
+    local md5sum="$(md5sum $conffile | sed -e 's/ .*//')"
+    local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKG | \
+        sed -n -e "\' $conffile ' { s/ obsolete$//; s/.* //; p }")"
+
+    if [ "$md5sum" = "$old_md5sum" ]; then
+        mv -f "$conffile" "$conffile.dpkg-remove"
+    fi
+}
+
+case "$1" in
+    install|upgrade)
+        prepare_mv_conffile /etc/apache2/conf.d/$PKG.conf
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+exit 0
diff --git a/debian/prerm b/debian/prerm
new file mode 100755 (executable)
index 0000000..81704a8
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -e
+
+PKG="webalizer-cn"
+
+if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
+    . /usr/share/apache2/apache2-maintscript-helper
+
+    webalizer_enable() {
+        echo "CN: Disabling $PKG configuration for Apache2."
+        return 0
+    }
+else
+    echo "CN: Could not load Apache 2.4 maintainer script helper."
+
+    webalizer_enable() {
+        return 1
+    }
+fi
+
+webalizer_error() {
+    echo "CN: Error while trying to disable $PKG configuration for Apache2."
+}
+
+#DEBHELPER#
+
+if ! apache2ctl configtest >/dev/null 2>&1; then
+    echo "CN: Your Apache2 configuration seems to be broken."
+    echo "CN: Please, check the service and system logs!"
+fi
+
+exit 0
index cbe925d..8d2b94a 100755 (executable)
@@ -1,3 +1,8 @@
 #!/usr/bin/make -f
 #!/usr/bin/make -f
+
 %:
        dh $@
 %:
        dh $@
+
+override_dh_install:
+       dh_install
+       dh_apache2 --conditional=webalizer_enable --error-handler=webalizer_error
index d211686..0c56621 100644 (file)
@@ -4,7 +4,8 @@ Alias /stats /var/www/webalizer
        AuthName Stats
        AuthUserFile /var/www/webalizer/.htpasswd
 
        AuthName Stats
        AuthUserFile /var/www/webalizer/.htpasswd
 
-       <Limit GET POST>
-               require valid-user
-       </Limit>
+       <RequireAll>
+               Require method GET POST
+               Require valid-user
+       </RequireAll>
 </Directory>
 </Directory>