tags 397383 patch
thanks

Julien Danjou <[EMAIL PROTECTED]> wrote:

> Package: webalizer
> Version: 2.01.10-30.1
> Severity: serious
>
> Hi,
>
> It seems that you're doing things in .config file that should be in
> postinst:

Here's a patch:

diff -Nur webalizer-2.01.10.old/debian/changelog webalizer-2.01.10/debian/changelog
--- webalizer-2.01.10.old/debian/changelog	2006-11-07 11:10:41.000000000 +0100
+++ webalizer-2.01.10/debian/changelog	2006-11-07 11:10:13.000000000 +0100
@@ -1,3 +1,11 @@
+webalizer (2.01.10-30.2) unstable; urgency=low
+
+  * Move actual configuration of the package to the postinst script.  The
+    config script now only contains the questions (closes: #397383).
+    Thanks to Julien Danjou <[EMAIL PROTECTED]>.
+
+ -- Frank Küster <[EMAIL PROTECTED]>  Tue,  7 Nov 2006 11:10:12 +0100
+
 webalizer (2.01.10-30.1) unstable; urgency=medium
 
   * Non-maintainer upload for RC bug.
diff -Nur webalizer-2.01.10.old/debian/config webalizer-2.01.10/debian/config
--- webalizer-2.01.10.old/debian/config	2006-11-07 11:10:41.000000000 +0100
+++ webalizer-2.01.10/debian/config	2006-11-07 11:11:53.000000000 +0100
@@ -23,36 +23,22 @@
 
       if [ -f "/etc/webalizer.conf" ] && [ ! -f "/etc/webalizer/webalizer.conf" ]; then
         mv /etc/webalizer.conf /etc/webalizer/webalizer.conf;
+	# although we're already configured, the script should *not*
+	# exit here.  Instead, it should parse the existing
+	# configuration, preseed the debconf answers accordingly and
+	# ask them again.  This is the only way to make
+	# "dpkg-reconfigure" work
         exit 0;  # already configured
       fi
       [ ! -f "/etc/webalizer/webalizer.conf" ] || exit 0;
       
-      # Now determine the system's hostname and domainname
-      HOSTNAME=$(/bin/hostname);
-      
       # Ask for the directory the output should be put in
       db_input medium webalizer/directory || true
       db_go
-      db_get webalizer/directory
-      OUTPUTDIR="$RET";
-      [ ! -z $OUTPUTDIR ] || OUTPUTDIR="/var/www/webalizer";
-      
-      if [ ! -d $OUTPUTDIR ]; then
-        mkdir -p $OUTPUTDIR;
-        if [ $? -eq 0 ]; then
-          echo "$OUTPUTDIR created";
-        else
-          echo "Something went wrong...";
-          exit 1;
-        fi;
-      fi
       
       # At this point, ask the user what the title of webalizer's reports should be
       db_input medium webalizer/doc_title || true
       db_go
-      db_get webalizer/doc_title
-      REPORTTITLE="$RET";
-      [ ! -z "$REPORTTITLE" ] || REPORTTITLE="Usage statistics for";
 
       # Ask for the rotated logfile
       # by default  is access log file of apache, but if I found apache2 log file,
@@ -68,16 +54,6 @@
       db_set "webalizer/logfile" $LOGFILE || true
       db_input medium webalizer/logfile || true
       db_go
-      db_get webalizer/logfile
-      [ ! -z "$RET" ] || LOGFILE="$RET";
-      
-      # Finally put these variables in /etc/webalizer/webalizer.conf using sed
-      cat /usr/share/doc/webalizer/examples/sample.conf.gz | gunzip | /bin/sed \
-	-e "s/^#HostName .*/HostName ${HOSTNAME}/" \
-	-e "s|^#OutputDir .*|OutputDir ${OUTPUTDIR}|" \
-	-e "s/^#ReportTitle .*/ReportTitle ${REPORTTITLE}/" \
-	-e "s|^#LogFile .*|LogFile ${LOGFILE}|" \
-	> /etc/webalizer/webalizer.conf;
     ;;
 
     reconfigure)
diff -Nur webalizer-2.01.10.old/debian/postinst webalizer-2.01.10/debian/postinst
--- webalizer-2.01.10.old/debian/postinst	2006-11-07 11:10:41.000000000 +0100
+++ webalizer-2.01.10/debian/postinst	2006-11-07 11:02:45.000000000 +0100
@@ -23,6 +23,37 @@
 
 case "$1" in
     configure)
+      # Now determine the system's hostname and domainname
+      HOSTNAME=$(/bin/hostname);
+      
+      db_get webalizer/directory
+      OUTPUTDIR="$RET";
+      [ ! -z $OUTPUTDIR ] || OUTPUTDIR="/var/www/webalizer";
+      
+      if [ ! -d $OUTPUTDIR ]; then
+        mkdir -p $OUTPUTDIR;
+        if [ $? -eq 0 ]; then
+          echo "$OUTPUTDIR created";
+        else
+          echo "Something went wrong...";
+          exit 1;
+        fi;
+      fi
+
+      db_get webalizer/doc_title
+      REPORTTITLE="$RET";
+      [ ! -z "$REPORTTITLE" ] || REPORTTITLE="Usage statistics for";
+
+      db_get webalizer/logfile
+      [ ! -z "$RET" ] || LOGFILE="$RET";
+      
+      # Finally put these variables in /etc/webalizer/webalizer.conf using sed
+      cat /usr/share/doc/webalizer/examples/sample.conf.gz | gunzip | /bin/sed \
+	-e "s/^#HostName .*/HostName ${HOSTNAME}/" \
+	-e "s|^#OutputDir .*|OutputDir ${OUTPUTDIR}|" \
+	-e "s/^#ReportTitle .*/ReportTitle ${REPORTTITLE}/" \
+	-e "s|^#LogFile .*|LogFile ${LOGFILE}|" \
+	> /etc/webalizer/webalizer.conf;
 
     ;;
 
Regards, Frank
-- 
Dr. Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)

Reply via email to