Package: portmap
Version: 6.0.0-1
Severity: important
Tags: patch
User: debian-...@lists.debian.org
Usertags: debian-edu

With the new default setting in portmap, NFS do no longer work out of
the box with Debian Edu (BTS report #570776).  I tried preseeding the
portmap/loopback value, but this do not work because the preinst code
hardcode the setting and ignore the preseeding.  This is a fatal bug
for Debian Edu.

This patch solve the issue, by moving the code generating
/etc/default/portmap to the postinst script, and adjusting the default
setting based on the current debconf value.

diff -u portmap-6.0.0/debian/preinst portmap-6.0.0/debian/preinst
--- portmap-6.0.0/debian/preinst
+++ portmap-6.0.0/debian/preinst
@@ -5,23 +5,6 @@
 version=$2
 CONFFILE=/etc/default/portmap

-create_config() {
-        cat <<EOF > $CONFFILE
-# Portmap configuration file
-#
-# Note: if you manually edit this configuration file,
-# portmap configuration scripts will avoid modifying it
-# (for example, by running 'dpkg-reconfigure portmap').
-
-# If you want portmap to listen only to the loopback
-# interface, uncomment the following line (it will be
-# uncommented automatically if you configure this
-# through debconf).
-OPTIONS="-i 127.0.0.1"
-EOF
-        chmod 0644 $CONFFILE
-}
-
 # TBD: should be based on a given version
 if [ "$action" = "upgrade" ] && [ -e /etc/portmap.conf ] \
    && dpkg --compare-versions "$version" gt 5-10 \
@@ -34,18 +17,6 @@
 fi


-# On install only, create the config file if it does not exist
-#
-if [ ! -e $CONFFILE ] ; then
-       if  [ -z "$version" ] ; then
-               create_config
-       elif [ -n "$version" ] && [ "$action" = "upgrade" ] && \
-            dpkg --compare-versions "$version" lt 5-6; then
-# or if upgrading from version older than 5-6 (which provided the file)
-            create_config
-       fi
-fi
-
 #DEBHELPER#

 exit 0
diff -u portmap-6.0.0/debian/postinst portmap-6.0.0/debian/postinst
--- portmap-6.0.0/debian/postinst
+++ portmap-6.0.0/debian/postinst
@@ -6,6 +6,41 @@

 CONFFILE=/etc/default/portmap

+create_config() {
+        cat <<EOF > $CONFFILE
+# Portmap configuration file
+#
+# Note: if you manually edit this configuration file,
+# portmap configuration scripts will avoid modifying it
+# (for example, by running 'dpkg-reconfigure portmap').
+
+# If you want portmap to listen only to the loopback
+# interface, uncomment the following line (it will be
+# uncommented automatically if you configure this
+# through debconf).
+EOF
+        # Allow the installation default to be preseeded
+        db_get portmap/loopback
+        if [ "true" = "$RET" ] ; then
+                echo 'OPTIONS="-i 127.0.0.1"' >> $CONFFILE
+        else
+                echo 'OPTIONS=""' >> $CONFFILE
+        fi
+        chmod 0644 $CONFFILE
+}
+
+# On install only, create the config file if it does not exist
+#
+if [ ! -e $CONFFILE ] ; then
+       if  [ -z "$version" ] ; then
+               create_config
+       elif [ -n "$version" ] && [ "$action" = "upgrade" ] && \
+            dpkg --compare-versions "$version" lt 5-6; then
+# or if upgrading from version older than 5-6 (which provided the file)
+            create_config
+       fi
+fi
+
 if [ "$1" = "configure" ] && [ -n "$2" ] &&
   dpkg --compare-versions "$2" lt 5-3; then
        err=$( update-rc.d -f portmap remove 2>&1 > /dev/null ) || {

Happy hacking,
-- 
Petter Reinholdtsen



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to