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

Bug#240686: choose-mirror: Strange code to detect country



Package: choose-mirror
Version: 0.040
Severity: normal
Tags: patch

I'm not quite sure exactly what this code is supposed to do since
debconf_get will always return 0 unless the template doesn't exist:
if (debconf_get(debconf, DEBCONF_BASE "country") == 0)
	// Not set yet. Seed with a default value
	if ((debconf_get(debconf, "debian-installer/country") == 0) &&
	    (debconf->value != NULL) ) {
			country = strdup (debconf->value);
			debconf_set (debconf, DEBCONF_BASE "country", country);
	}
} else {
	country = debconf->value;
}

But according to the comments, I assume that it is supposed to set the value
of mirror/country to that of debian-installer/country iff it has not been set
already (e.g. by pre-seeding), so here is a patch to do that:
--- choose-mirror.c	(revision 12019)
+++ choose-mirror.c	(working copy)
@@ -122,7 +122,8 @@
 	country = NULL;
 
 	/* Pick a default country from elsewhere, eg countrychooser,*/
-	if (debconf_get(debconf, DEBCONF_BASE "country") == 0) {
+	debconf_get(debconf, DEBCONF_BASE "country");
+	if (strcmp(debconf->value, "question will be asked") == 0) {
 		// Not set yet. Seed with a default value
 		if ((debconf_get(debconf, "debian-installer/country") == 0) &&
 		    (debconf->value != NULL) ) {

-- 
Martin Orr
Linux Administrator,
Methodist College Belfast



Reply to: