Package: polipo
Version: 1.0.4.1-1
Severity: normal
Tags: patch

Hi Erinn,

the latest polipo upload removed the offline and online options from
polipo-control, but left in place conffiles that keep calling
polipo-control with those options.  The attached patch should fix that.

Cheers,
Julien
diff -u polipo-1.0.4.1/debian/polipo.postrm polipo-1.0.4.1/debian/polipo.postrm
--- polipo-1.0.4.1/debian/polipo.postrm
+++ polipo-1.0.4.1/debian/polipo.postrm
@@ -10,6 +10,15 @@
 IPUP_D=/etc/ppp/ip-up.d
 IPDOWN_D=/etc/ppp/ip-down.d
 
+rm_conffile() {
+    local PKGNAME="$1" # Unused
+    local CONFFILE="$2"
+
+    if [ -f "$CONFFILE".dpkg-del ]; then
+        mv -f "$CONFFILE".dpkg-del "$CONFFILE"
+    fi
+}
+
 case "$1" in
     purge)
 
@@ -20,16 +29,18 @@
 	    echo " done"
 	done
 
-# Removing old /etc/ppp/ip-up/down.d/ scripts
-	for D in "$IPUP_D" "$IPDOWN_D"; do
-	    if [ -e "$D/polipo.old" ]; then
-		rm -f "$D/polipo.old"
-	    fi
-	done
+    ;;
 
+    abort-install|abort-upgrade)
+        if dpkg --compare-versions "$2" le 1.0.4.1-1; then
+            rm_conffile polipo /etc/ppp/ip-up.d/1polipo
+            rm_conffile polipo /etc/ppp/ip-down.d/1polipo
+            rm_conffile polipo /etc/network/if-up.d/01polipo
+            rm_conffile polipo /etc/network/if-down.d/01polipo
+        fi
     ;;
 
-    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    remove|upgrade|failed-upgrade|disappear)
 
     ;;
 
diff -u polipo-1.0.4.1/debian/changelog polipo-1.0.4.1/debian/changelog
--- polipo-1.0.4.1/debian/changelog
+++ polipo-1.0.4.1/debian/changelog
@@ -1,3 +1,10 @@
+polipo (1.0.4.1-2) UNRELEASED; urgency=low
+
+  * Delete obsolete /etc/network/if-{up,down}.d and /etc/ppp/ip-{up,down}.d
+    scripts.
+
+ -- Julien Cristau <jcris...@debian.org>  Sat, 01 May 2010 17:48:59 +0200
+
 polipo (1.0.4.1-1) unstable; urgency=low
 
   * New maintainer.
diff -u polipo-1.0.4.1/debian/polipo.postinst polipo-1.0.4.1/debian/polipo.postinst
--- polipo-1.0.4.1/debian/polipo.postinst
+++ polipo-1.0.4.1/debian/polipo.postinst
@@ -9,9 +9,25 @@
 IPUP_D=/etc/ppp/ip-up.d
 IPDOWN_D=/etc/ppp/ip-down.d
 
+rm_conffile() {
+    local PKGNAME="$1" # Unused
+    local CONFFILE="$2"
+    if [ -f "$CONFFILE".dpkg-del ]; then
+        rm -f "$CONFFILE".dpkg-del
+    fi
+}
+
 case "$1" in
     configure)
 
+        # delete obsolete conffiles
+        if dpkg --compare-versions "$2" le 1.0.4.1-1; then
+            rm_conffile polipo /etc/ppp/ip-up.d/1polipo
+            rm_conffile polipo /etc/ppp/ip-down.d/1polipo
+            rm_conffile polipo /etc/network/if-up.d/01polipo
+            rm_conffile polipo /etc/network/if-down.d/01polipo
+        fi
+
 # Creating needed directories
         mkdir -p "$CACHE_DIR"
 	chown proxy:proxy "$CACHE_DIR"
@@ -24,14 +40,6 @@
 	chown proxy:adm "$LOG_DIR"
 	chmod 2755 "$LOG_DIR"
 
-# /etc/ppp/ip-up/down.d/1polipo used to be called ip-up/down/polipo, so move
-# the old one out of the way
-	for D in "$IPUP_D" "$IPDOWN_D"; do
-	    if [ -e "$D/polipo" ]; then
-		mv "$D/polipo" "$D/polipo.old"
-	    fi
-	done
-
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
reverted:
--- polipo-1.0.4.1/debian/updown/ip-up/1polipo
+++ polipo-1.0.4.1.orig/debian/updown/ip-up/1polipo
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-set -e
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
-OPTION_FILE=/etc/polipo/options
-PPCTL=/usr/lib/polipo/polipo-control
-test -x $PPCTL  || exit 0
-
-# Exit if lo interface
-[ "$METHOD" = "loopback" ] && exit 0
-
-if [ -f $OPTION_FILE ] && \
-	( grep -qsxi '^[[:blank:]]*method[[:blank:]]*any[[:blank:]]*$' $OPTION_FILE \
-	|| grep -qsxi '^[[:blank:]]*method[[:blank:]]*ppp[[:blank:]]*$' $OPTION_FILE ) then
-    $PPCTL go-online
-fi
-
-exit 0
reverted:
--- polipo-1.0.4.1/debian/updown/if-up/01polipo
+++ polipo-1.0.4.1.orig/debian/updown/if-up/01polipo
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-set -e
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
-OPTION_FILE=/etc/polipo/options
-PPCTL=/usr/lib/polipo/polipo-control
-test -x $PPCTL  || exit 0
-
-# Exit if lo interface
-[ "$METHOD" = "loopback" ] && exit 0
-
-if [ -f $OPTION_FILE ] && \
-	( grep -qsxi '^[[:blank:]]*method[[:blank:]]*any[[:blank:]]*$' $OPTION_FILE \
-	|| grep -qsxi '^[[:blank:]]*method[[:blank:]]*$METHOD[[:blank:]]*$' $OPTION_FILE ) then
-    $PPCTL go-online
-fi
-
-exit 0
reverted:
--- polipo-1.0.4.1/debian/updown/ip-down/1polipo
+++ polipo-1.0.4.1.orig/debian/updown/ip-down/1polipo
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-set -e
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
-OPTION_FILE=/etc/polipo/options
-PPCTL=/usr/lib/polipo/polipo-control
-test -x $PPCTL  || exit 0
-
-# Exit if lo interface
-[ "$METHOD" = "loopback" ] && exit 0
-
-if [ -f $OPTION_FILE ] && \
-	( grep -qsxi '^[[:blank:]]*method[[:blank:]]*any[[:blank:]]*$' $OPTION_FILE \
-	|| grep -qsxi '^[[:blank:]]*method[[:blank:]]*ppp[[:blank:]]*$' $OPTION_FILE ) then
-    $PPCTL go-offline
-fi
-
-exit 0
reverted:
--- polipo-1.0.4.1/debian/updown/if-down/01polipo
+++ polipo-1.0.4.1.orig/debian/updown/if-down/01polipo
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-set -e
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
-OPTION_FILE=/etc/polipo/options
-PPCTL=/usr/lib/polipo/polipo-control
-test -x $PPCTL  || exit 0
-
-# Exit if lo interface
-[ "$METHOD" = "loopback" ] && exit 0
-
-if [ -f $OPTION_FILE ] && \
-	( grep -qsxi '^[[:blank:]]*method[[:blank:]]*any[[:blank:]]*$' $OPTION_FILE \
-	|| grep -qsxi '^[[:blank:]]*method[[:blank:]]*$METHOD[[:blank:]]*$' $OPTION_FILE ) then
-    $PPCTL go-offline
-fi
-
-exit 0
only in patch2:
unchanged:
--- polipo-1.0.4.1.orig/debian/polipo.preinst
+++ polipo-1.0.4.1/debian/polipo.preinst
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# Remove a no-longer used conffile
+rm_conffile() {
+    local PKGNAME="$1"
+    local CONFFILE="$2"
+
+    [ -e "$CONFFILE" ] || return 0
+
+    local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
+    local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
+            sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
+    if [ "$md5sum" != "$old_md5sum" ]; then
+        echo "Obsolete conffile $CONFFILE has been modified by you."
+        echo "Saving as $CONFFILE.dpkg-bak ..."
+        mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+    else
+        echo "Removing obsolete conffile $CONFFILE ..."
+        mv -f "$CONFFILE" "$CONFFILE".dpkg-del
+    fi
+}
+
+case "$1" in
+install|upgrade)
+    if dpkg --compare-versions "$2" le "1.0.4.1-1"; then
+        rm_conffile polipo /etc/ppp/ip-up.d/1polipo
+        rm_conffile polipo /etc/ppp/ip-down.d/1polipo
+        rm_conffile polipo /etc/network/if-up.d/01polipo
+        rm_conffile polipo /etc/network/if-down.d/01polipo
+    fi
+esac
+
+#DEBHELPER#

Attachment: signature.asc
Description: Digital signature

Reply via email to