Package: dhcdbd
Version: 3.0-1
Severity: normal
Tags: patch
User: [EMAIL PROTECTED]
Usertags: origin-ubuntu ubuntu-patch hardy 

In Ubuntu, we've applied the attached patch to achieve the following:

 * debian/rules: Install dhclient-exit-hook.d script as 'zzzz_dhcdbd'
   instead of 'dhcdbd', so that it is ran as last script.
   Otherwise it gets called before 'zzz_avahi-autoipd' and thus
   network-manager doesn't pick up the fact that
   avahi-autoipd is running on the interface.
 * debian/dhcdbd.{preinst,postinst,postrm}: Do the renaming on upgrades,
   take care to avoid the dpkg conffile question if the script was not
   modified, and gracefully handle aborted upgrades.

This ensures that dhcdbd does not miss changes from hooks which were
called after dhcdbd's.

Martin

-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org
diff -u dhcdbd-3.0/debian/dhcdbd.postrm dhcdbd-3.0/debian/dhcdbd.postrm
--- dhcdbd-3.0/debian/dhcdbd.postrm
+++ dhcdbd-3.0/debian/dhcdbd.postrm
@@ -69,8 +69,16 @@
     abort-install|abort-upgrade)
 	# Abort upgrade from previous versions
         if dpkg --compare-versions "$2" lt "2.0-4"; then
	    undo_rm_conffile /etc/dbus-1/event.d/24dhcdbd
 	fi
+        # do the dhcdbd -> zzzz_dhcdbd rename on upgrades
+        if dpkg --compare-versions "$2" le-nl "3.0-2"; then
+           F=/etc/dhcp3/dhclient-exit-hooks.d/dhcdbd
+           if [ -e $F.moved-by-preinst ]; then
+               mv -f $F.moved-by-preinst $F
+           fi
+        fi
+
 	;;
 
     *)
diff -u dhcdbd-3.0/debian/dhcdbd.preinst dhcdbd-3.0/debian/dhcdbd.preinst
--- dhcdbd-3.0/debian/dhcdbd.preinst
+++ dhcdbd-3.0/debian/dhcdbd.preinst
@@ -33,6 +33,22 @@
     fi
 }
 
+# do the dhcdbd -> zzzz_dhcdbd rename on upgrades
+if [ "$1" = install ] || [ "$1" = upgrade ]; then
+    if dpkg --compare-versions "$2" le-nl "3.0-2"; then
+       OLD=/etc/dhcp3/dhclient-exit-hooks.d/dhcdbd
+       NEW=/etc/dhcp3/dhclient-exit-hooks.d/zzzz_dhcdbd
+       if [ -e "$OLD" ]; then
+           md5sum="`md5sum \"$OLD\" | sed -e \"s/ .*//\"`"
+           old_md5sum="`dpkg -s dhcdbd | sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $OLD'{s/.* //;p}}\"`"
+           if [ "$md5sum" = "$old_md5sum" ]; then
+               mv -f "$OLD" "$OLD.moved-by-preinst"
+           else
+               mv -f "$OLD" "$NEW"
+           fi
+       fi
+    fi
+fi
 
 case "$1" in
     install)
diff -u dhcdbd-3.0/debian/rules dhcdbd-3.0/debian/rules
--- dhcdbd-3.0/debian/rules
+++ dhcdbd-3.0/debian/rules
@@ -15,3 +15,3 @@
 	install -m 644  $(CURDIR)/debian/dhcdbd.dhcp3 \
-		$(CURDIR)/debian/dhcdbd/etc/dhcp3/dhclient-exit-hooks.d/dhcdbd
+		$(CURDIR)/debian/dhcdbd/etc/dhcp3/dhclient-exit-hooks.d/zzzz_dhcdbd
 
diff -u dhcdbd-3.0/debian/dhcdbd.postinst dhcdbd-3.0/debian/dhcdbd.postinst
--- dhcdbd-3.0/debian/dhcdbd.postinst
+++ dhcdbd-3.0/debian/dhcdbd.postinst
@@ -32,8 +32,14 @@
     configure)
 	# Upgrade from previous versions
         if dpkg --compare-versions "$2" lt "2.0-4"; then
	    rm_conffile /etc/dbus-1/event.d/24dhcdbd
 	fi
+
+        # finish the dhcdbd -> zzzz_dhcdbd rename on upgrades
+        F=/etc/dhcp3/dhclient-exit-hooks.d/dhcdbd.moved-by-preinst
+        if dpkg --compare-versions "$2" le-nl "3.0-2" && [ -e $F ]; then
+            rm -f $F
+        fi
 	
 	if [ -x "/etc/init.d/dbus" ]; then
 	    invoke-rc.d dbus force-reload || true

Attachment: signature.asc
Description: Digital signature

Reply via email to