Hi,

I've created a patch which moves the update-alternatives commands to the
correct scripts and which also implements the strategy mentiones in
message 5 of bug #694051. Applying it to the source directory should
solve all problems related to these two bugs.

Cheers,
Frederik
diff -urN less-481.old/debian/less.postinst less-481/debian/less.postinst
--- less-481.old/debian/less.postinst	2016-01-11 13:08:57.000000000 +0100
+++ less-481/debian/less.postinst	2016-01-26 12:04:54.124486691 +0100
@@ -1,12 +1,66 @@
-#!/bin/sh
+#! /bin/sh
+# postinst script for less
+#
+# see: dh_installdeb(1)
+
 set -e
 
-if [ "$1" = 'configure' ]; then
-  for file in lessfile lesspipe lesskey lessecho less; do
-    if [ ! -e /usr/bin/$file ]; then
-      ln -s /bin/$file /usr/bin/$file
-    fi
-  done
-fi
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see /usr/doc/packaging-manual/
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+        update-alternatives --quiet --install /usr/bin/pager pager \
+	    /bin/less 77 --slave /usr/share/man/man1/pager.1.gz \
+	    pager.1.gz /usr/share/man/man1/less.1.gz
+
+      # This change needs to get into one stable release.
+      # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=694051
+        update-alternatives --quiet --remove pager /usr/bin/less
+
+      # Purge the debconf database we no longer need.
+      if [ -e /usr/share/debconf/confmodule ]; then
+        . /usr/share/debconf/confmodule
+        db_version 2.0
+        db_purge
+      fi
+
+      # install links in /bin
+      for file in lessfile lesspipe lesskey lessecho less; do
+        if [ ! -e /usr/bin/$file ]; then
+          ln -s /bin/$file /usr/bin/$file
+        fi
+      done
+
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 0
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
 
 #DEBHELPER#
+
+exit 0
diff -urN less-481.old/debian/less.postrm less-481/debian/less.postrm
--- less-481.old/debian/less.postrm	2016-01-11 13:08:57.000000000 +0100
+++ less-481/debian/less.postrm	2016-01-26 12:06:27.928916149 +0100
@@ -9,4 +9,9 @@
   done
 fi
 
+if [ "$1" = 'remove' -o "$1" = 'disappear' ]
+then
+    update-alternatives --quiet --remove pager /bin/less
+fi
+
 #DEBHELPER#
diff -urN less-481.old/debian/less.prerm less-481/debian/less.prerm
--- less-481.old/debian/less.prerm	1970-01-01 01:00:00.000000000 +0100
+++ less-481/debian/less.prerm	2016-01-26 12:01:23.683327144 +0100
@@ -0,0 +1,37 @@
+#! /bin/sh
+# prerm script for less
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see /usr/doc/packaging-manual/
+
+case "$1" in
+    remove)
+        update-alternatives --quiet --remove pager /bin/less
+        ;;
+    upgrade|failed-upgrade|deconfigure)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 0
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff -urN less-481.old/debian/postinst less-481/debian/postinst
--- less-481.old/debian/postinst	2014-09-08 06:08:25.000000000 +0200
+++ less-481/debian/postinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,59 +0,0 @@
-#! /bin/sh
-# postinst script for less
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see /usr/doc/packaging-manual/
-#
-# quoting from the policy:
-#     Any necessary prompting should almost always be confined to the
-#     post-installation script, and should be protected with a conditional
-#     so that unnecessary prompting doesn't happen if a package's
-#     installation fails and the `postinst' is called with `abort-upgrade',
-#     `abort-remove' or `abort-deconfigure'.
-
-case "$1" in
-    configure)
-        update-alternatives --quiet --install /usr/bin/pager pager \
-	    /bin/less 77 --slave /usr/share/man/man1/pager.1.gz \
-	    pager.1.gz /usr/share/man/man1/less.1.gz
-
-      # This change needs to get into one stable release.
-      # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=694051
-        update-alternatives --quiet --remove pager /usr/bin/less
-
-      # Purge the debconf database we no longer need.
-      if [ -e /usr/share/debconf/confmodule ]; then
-        . /usr/share/debconf/confmodule
-        db_version 2.0
-        db_purge
-      fi
-
-    ;;
-
-    abort-upgrade|abort-remove|abort-deconfigure)
-
-    ;;
-
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 0
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -urN less-481.old/debian/prerm less-481/debian/prerm
--- less-481.old/debian/prerm	2009-04-19 08:52:05.000000000 +0200
+++ less-481/debian/prerm	1970-01-01 01:00:00.000000000 +0100
@@ -1,37 +0,0 @@
-#! /bin/sh
-# prerm script for less
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <prerm> `remove'
-#        * <old-prerm> `upgrade' <new-version>
-#        * <new-prerm> `failed-upgrade' <old-version>
-#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
-#        * <deconfigured's-prerm> `deconfigure' `in-favour'
-#          <package-being-installed> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see /usr/doc/packaging-manual/
-
-case "$1" in
-    remove)
-	update-alternatives --quiet --remove pager /bin/less
-        ;;
-    upgrade|failed-upgrade|deconfigure)
-        ;;
-    *)
-        echo "prerm called with unknown argument \`$1'" >&2
-        exit 0
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-

Reply via email to