[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Debconf problem: Question asked twice



Hi,

there's again something I couldn't figure out in the documentation, and
my knowledge of C is to poor to understand dpkg's or dpkg-deb's
sourcecode. I have tried a patch to tetex-bin's configure script (see at
the end). The patch does what it's supposed to do (see #208408 if
interested). But the question I fiddled with is asked twice: Once when I
expect it, after the line 

Unpacking tetex-bin (from tetex-bin_2.0.2-4.3_i386.deb) ...

has been displayed, together with all other debconf questions. Then
comes "Setting up..." of an other package, and then it is shown a second
time when the line

Setting up tetex-bin (2.0.2-4.3) ...

is displayed. To be exactly, just before that, and it's before the
postinst is called (because redirected postinst output doesn't get
spoiled by dialog). I made sure that the seen flag is true after the
first time. Also, the answers I made are remembered. So how come that it
is asked the second time? BTW I do this in a pbuilder-sid-environment,
but the package was build on my working machine which is mixed
woody-bunk1 with a lot of own backports.

I would be grateful for any hints.

TIA, Frank



--- debian/config.orig	Wed Sep 10 19:42:28 2003
+++ debian/config	Wed Sep 10 19:44:37 2003
@@ -1,5 +1,7 @@
 #!/bin/sh -e
 
+DEFAULTS="french[=patois], ngerman[=naustrian-neue_Rechtschreibung]"
+
 # Use debconf.
 . /usr/share/debconf/confmodule || exit
 db_version 2.0
@@ -52,6 +54,38 @@
 db_go
 db_get tetex-bin/use_debconf || true
 if [ "$RET" = "true" ]; then
-db_input medium tetex-bin/hyphen || true
-db_go
+		db_fget tetex-bin/hyphen seen
+    # has this question been seen? If yes, we want to make the 
+    # values chosen part of the default
+		if [ "$RET" = "true" ]; then
+		    # inform the user that defaults have changed, and he will 
+				# have to manually choose (n)german and french
+				# db_input tetex-bin/hyphenhaschanged || true
+				db_get tetex-bin/hyphen
+		    # there might still have been no extra pattern selected
+				if [ -z "$RET" ]; then
+						DEFAULT_ANS="$DEFAULTS"				
+				else
+						DEFAULT_ANS="$DEFAULTS, $RET"
+			      # This time it's not necessary. But if we ever add
+      			# defaults again, we have to fish out double occurences
+					#	DEFAULTS_MERGED="$DEFAULTS, $RET"
+			    # DEFAULT_ANS=`echo -n  $DEFAULTS_MERGED | tr -d ',' | tr ' ' '\n' | sort -u | tr '\n' ',' | sed 's/,$//'`
+				fi
+		else
+		# the question has never been seen (either fresh install 
+		# or upgrading directly from woody), so there's nothing to keep:
+		DEFAULT_ANS="$DEFAULTS"				
+		fi
+		db_set tetex-bin/hyphen "$DEFAULT_ANS"
+    # Every user has to see this question, even if he/she has
+    # yet answered the question in a previous upgrade
+ 		db_fset tetex-bin/hyphen seen false
+		db_input medium tetex-bin/hyphen || true
+# 		db_fset tetex-bin/hyphen seen true
+		db_go
 fi
+
+db_fget tetex-bin/hyphen seen
+

-- 
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie



Reply to: