tags: patch
Package: fai
Version: 2.8.2

The attached patch should correct the problem of incorrect postinst
behaviour when editing conffiles, which lead to user's manual changes where
overwritten.

With this patch applied, postinst will read the old value from the conffile,
no matter if it was changed or not, and takes even the manual set value as
default, not changing it when the user stays with the default. That way, the
conffile can be edited manually, debconf will take manual edited values as
default, and dpkg-reconfigure will even work correctly with manual changed
values.

Henning
diff -Nur fai-2.8.2-unchanged/conf/fai.conf fai-2.8.2_debconf-bugfix-better/conf/fai.conf
--- fai-2.8.2-unchanged/conf/fai.conf	2005-04-06 16:26:09.000000000 +0200
+++ fai-2.8.2_debconf-bugfix-better/conf/fai.conf	2005-05-16 18:43:34.000000000 +0200
@@ -3,7 +3,7 @@
 # /etc/fai/fai.conf -- configuration for FAI (Fully Automatic Installation)
 
 # installserver must be the name seen by the install clients
-installserver=
+installserver=INSTALLSERVER
 # the name of the Debian mirror
 mirrorhost=MIRRORHOST
 
Binary files fai-2.8.2-unchanged/debian/.postinst.swp and fai-2.8.2_debconf-bugfix-better/debian/.postinst.swp differ
diff -Nur fai-2.8.2-unchanged/debian/postinst fai-2.8.2_debconf-bugfix-better/debian/postinst
--- fai-2.8.2-unchanged/debian/postinst	2005-04-27 10:16:42.000000000 +0200
+++ fai-2.8.2_debconf-bugfix-better/debian/postinst	2005-05-17 09:58:57.449760936 +0200
@@ -31,24 +31,35 @@
 #     `abort-remove' or `abort-deconfigure'.
 
 
+# define some needed functions
+get_installserver() {
+        source /etc/fai/fai.conf
+        echo $installserver
+}
+
+get_mirrorhost() {
+        source /etc/fai/fai.conf
+        echo $mirrorhost
+}
+
+
+
 case "$1" in
     configure)
 
         . /usr/share/debconf/confmodule
         # set installserver hostname to a reasonable value with debconf
         db_get fai/installserver
-        perl -pi -e "s/^installserver=.*\$/installserver=$RET/" /etc/fai/fai.conf || true
+	old_installserver=`get_installserver`
+        perl -pi -e "s/^installserver=$old_installserver\$/installserver=$RET/" /etc/fai/fai.conf || true
 
         # set mirrorhost in  /etc/fai.conf and  /etc/fai/sources.list as
         # defined in debconf db
         db_get fai/mirrorhost
+	old_mirrorhost=`get_mirrorhost`
 	set +e
-        grep -q MIRRORHOST /etc/fai/fai.conf
-        if [ $? -eq 0 ] ; then
-          perl -pi -e "s/MIRRORHOST/$RET/" /etc/fai/fai.conf
-        else
-          perl -pi -e "s/^mirrorhost=MIRRORHOST\$/mirrorhost=$RET/" /etc/fai/fai.conf
-        fi
+        perl -pi -e "s/^mirrorhost=$old_mirrorhost\$/mirrorhost=$RET/" /etc/fai/fai.conf
+
         perl -pi -e "s/MIRRORHOST/$RET/" /etc/fai/sources.list
 	set -e
         db_get fai/run-faisetup-on-install || true

Reply via email to