Control: tags -1 patch pending

Hi,

On Thu, Apr 06, 2017 at 10:58:58PM +0200, Ivo De Decker wrote:
> On Sun, Nov 22, 2015 at 04:32:34PM +0100, Andreas Bombe wrote:
> > The symlink is not marked as a conffile because debhelper (specifically
> > dh_installdeb) does not mark symlinks to be installed in /etc as
> > conffiles. According to #421346 this is intentional as dpkg does not
> > work correctly with conffile symlinks (#421344, #690051). Thus the
> > apparent fix of marking it as a conffile explicitly is likely unwise.
> 
> The workaround is to stop shipping the symlink in the package, but create it
> in postinst (and remove it on purge in postrm). This probably needs some care
> to handle the upgrade.

I prepared an NMU that does that (patch attach). I will upload it shortly.

Cheers,

Ivo

diff -u dsh-0.25.10/debian/changelog dsh-0.25.10/debian/changelog
--- dsh-0.25.10/debian/changelog
+++ dsh-0.25.10/debian/changelog
@@ -1,3 +1,10 @@
+dsh (0.25.10-1.3) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Don't ship symlink for /etc/dsh/group/all. (Closes: #788585)
+
+ -- Ivo De Decker <iv...@debian.org>  Sat, 08 Apr 2017 23:58:21 +0200
+
 dsh (0.25.10-1.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -u dsh-0.25.10/debian/postrm dsh-0.25.10/debian/postrm
--- dsh-0.25.10/debian/postrm
+++ dsh-0.25.10/debian/postrm
@@ -1,6 +1,9 @@
 #! /bin/sh
 
 if [ "$1" = "purge" ]; then
+  rm -f /etc/dsh/group/all
+  # might be created in preinst on upgrade
+  rm -f /etc/dsh/group/all.dpkg-backup
   rmdir --ignore-fail-on-non-empty /etc/dsh/group
   rmdir --ignore-fail-on-non-empty /etc/dsh
 fi
diff -u dsh-0.25.10/debian/rules dsh-0.25.10/debian/rules
--- dsh-0.25.10/debian/rules
+++ dsh-0.25.10/debian/rules
@@ -56,7 +56,6 @@
        $(MAKE) install DESTDIR=$(CURDIR)/debian/dsh
        cp $(CURDIR)/debian/machines.list 
$(CURDIR)/debian/dsh/etc/dsh/machines.list
        cp $(CURDIR)/dsh.conf $(CURDIR)/debian/dsh/etc/dsh/dsh.conf
-       ln -s ../machines.list $(CURDIR)/debian/dsh/etc/dsh/group/all
        install -d $(CURDIR)/debian/dsh/usr/lib/update-cluster
        install -m 755 $(CURDIR)/debian/dsh.updatelist 
$(CURDIR)/debian/dsh/usr/lib/update-cluster/
 
diff -u dsh-0.25.10/debian/postinst dsh-0.25.10/debian/postinst
--- dsh-0.25.10.orig/debian/postinst
+++ dsh-0.25.10/debian/postinst
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+if [ "$1" = "configure" ] && [ -z "$2" ]; then
+       if [ ! -e /etc/dsh/group/all ]
+       then
+               # manually create the symlink instead of shipping it
+               # see https://bugs.debian.org/788585
+               ln -s ../machines.list /etc/dsh/group/all
+       fi
+fi
+
+# see preinst
+SYMLINK="/etc/dsh/group/all"
+LASTVERSION="0.25.10-1.3~"
+
+if [ "$1" = "configure" ] &&
+   [ -n "$2" ] &&
+   dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
+       if [ -e ${SYMLINK}.dpkg-backup -o -h ${SYMLINK}.dpkg-backup ] &&
+          [ ! -e "$SYMLINK" ]
+       then
+               mv -f "${SYMLINK}.dpkg-backup" "$SYMLINK"
+       fi
+fi
+
+#DEBHELPER#
+
diff -u dsh-0.25.10/debian/preinst dsh-0.25.10/debian/preinst
--- dsh-0.25.10.orig/debian/preinst
+++ dsh-0.25.10/debian/preinst
@@ -0,0 +1,20 @@
+#! /bin/sh
+
+# Handle the upgrade from the symlink shipped in the package to the symlink
+# created by the postinst
+# see https://bugs.debian.org/788585
+
+# this code is based on symlink_to_dir in dpkg-maintscript-helper
+
+# note that this also works if /etc/dsh/group/all is not a symlink
+SYMLINK="/etc/dsh/group/all"
+LASTVERSION="0.25.10-1.3~"
+
+if [ "$1" = "install" -o "$1" = "upgrade" ] &&
+   [ -n "$2" ] && [ -h "$SYMLINK" -o -e "$SYMLINK" ] &&
+   dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
+       mv -f "$SYMLINK" "${SYMLINK}.dpkg-backup"
+fi
+
+#DEBHELPER#
+

Reply via email to