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

[RFR] Proposal for installs without network connection



With Beta 2 we have lost the option to (easily) install without using a 
network connection. There have been several comments about this.

This proposal is intended to support that option again.
It is intended primairily for full CD installs (including hd-media where a 
full CD image is used).
It can also be used with netinst installs, but in that case it will result 
in an extremely minimal system as tasksel won't be able to install any 
extra packages.

As this proposal affects a number of components, I think it is important 
to discuss this before starting to implement.

1) Add a boolean preseedable option debian-installer/no_net
If this option is set on boot the following will happen:
- netcfg will not go into dhcp by default, but default to static config
- choose-mirror will be skipped, unless /cdrom/.disk/base_installable
  is not present in which case a fatal error will be shown
- in apt-setup, the generators for network sources will be skipped

2) The template debian-installer/no_net will be used internally too:
- if no NIC is detected or the user selects not to configure the network,
  no_net will be set automatically
- if /cdrom/.disk/base_installable is present, choose-mirror will offer
  an extra option "don't use a network mirror" [1]; if that is selected,
  no_net will be set automatically

One thing that is not covered yet is how to "reset" the no_net option to 
false, but IMO that is not very important.


[1] A tested patch for this is attached.
What I don't like about it is the duplication of the templates (which use 
quite a lot of space), but adding extra translated options in a Choices 
list on the fly is quite difficult.
I'd very much appreciate comments on this patch too.

Alternative would be to add a separate question in choose-mirror to offer 
to skip it (which would only be shown if /cdrom/.disk/base_installable is 
present). Disadvantage is that this question should probably only be 
shown at medium/low priority and thus limit not using the network to 
those installs, but it has the advantage of allowing to reset the no_net 
option through that question.

Index: mktemplates
===================================================================
--- mktemplates	(revision 36098)
+++ mktemplates	(working copy)
@@ -40,9 +40,8 @@
 		echo
 	done
 ) | debian/templates-build.pl "$DEB_HOST_ARCH" | \
-    perl -pe 'if (m,http/countries$,) { $http = 1; } elsif ($http and /enter information manually$/) { s/$/, '"$HTTPCHOICES"'/; $http = 0; }' | \
-    perl -pe 'if (m,ftp/countries$,)  { $ftp  = 1; } elsif ($ftp  and /enter information manually$/) { s/$/, '"$FTPCHOICES"'/;  $ftp  = 0; }' | \
-    sed "/^_Choices: enter/s/_Choices:/__Choices:/g" \
+    perl -pe 'if (m,http/countries(_alt)?$,) { $http = 1; } elsif ($http and /enter information manually$/) { s/$/, '"$HTTPCHOICES"'/; $http = 0; }' | \
+    perl -pe 'if (m,ftp/countries(_alt)?$,)  { $ftp  = 1; } elsif ($ftp  and /enter information manually$/) { s/$/, '"$FTPCHOICES"'/;  $ftp  = 0; }' \
     >debian/templates.tmp
 printf " Done.\n"
 
Index: choose-mirror.c
===================================================================
--- choose-mirror.c	(revision 36098)
+++ choose-mirror.c	(working copy)
@@ -230,35 +230,37 @@
 		country = "US";
 	}
 
-#ifdef WITH_HTTP
-	if (strcasecmp(protocol,"http") == 0) {
-		if (has_mirror(country)) {
-			debconf_set(debconf, DEBCONF_BASE "http/countries", country);
-			debconf_fget(debconf, DEBCONF_BASE "country", "seen");
-			debconf_fset(debconf, DEBCONF_BASE "http/countries", "seen", debconf->value);
-		}
-		debconf_input(debconf, "high", DEBCONF_BASE "http/countries");
+	char *countries;
+	countries = add_protocol("countries");
+	if (base_on_cd) {
+		char *countries_alt;
+		countries_alt = add_protocol("countries_alt");
+		debconf_register(debconf, countries_alt, countries);
+		free (countries_alt);
 	}
-#endif
-#ifdef WITH_FTP
-	if (strcasecmp(protocol,"ftp") == 0) {
-		if (has_mirror(country)) {
-			debconf_set(debconf, DEBCONF_BASE "ftp/countries", country);
-			debconf_fget(debconf, DEBCONF_BASE "country", "seen");
-			debconf_fset(debconf, DEBCONF_BASE "http/countries", "seen", debconf->value);
-		}
-		debconf_input(debconf, "high", DEBCONF_BASE "ftp/countries");
+
+	if (has_mirror(country)) {
+		debconf_set(debconf, countries, country);
+		debconf_fget(debconf, DEBCONF_BASE "country", "seen");
+		debconf_fset(debconf, countries, "seen", debconf->value);
 	}
-#endif
+	debconf_input(debconf, "high", countries);
 
+	free (countries);
 	return 0;
 }
 
 static int set_country(void) {
-	debconf_get(debconf, (strcasecmp(protocol,"http") == 0 ) ?
-		    DEBCONF_BASE "http/countries" : DEBCONF_BASE "ftp/countries");
+	char *countries;
+	countries = add_protocol("countries");
+
+	debconf_get(debconf, countries);
 	country = strdup(debconf->value);
 	debconf_set(debconf, DEBCONF_BASE "country", country);
+
+	free (countries);
+	if (! strcmp(country, "don't use a network mirror"))
+		return 9;
 	return 0;
 }
 
@@ -528,6 +530,7 @@
 }
 
 int main (void) {
+	int ret;
 	/* Use a state machine with a function to run in each state */
 	int state = 0;
 	int (*states[])() = {
@@ -553,8 +556,11 @@
 	di_system_init("choose-mirror");
 
 	while (state >= 0 && states[state]) {
-		if (states[state]() != 0) { /* back up to start */
-			state = 0;
+		if ((ret = states[state]()) != 0) {
+			if (ret == 9)
+				return 0;  /* quit mirror selection */
+			else
+				state = 0; /* back up to start */
 		}
 		else if (debconf_go(debconf)) { /* back up */
 			state = state - 1;
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 36101)
+++ debian/changelog	(working copy)
@@ -2,8 +2,10 @@
 
   * Do not allow to select a different suite when the base system will be
     installed from CD. Closes: #356105.
+  * Add option to not use a network mirror; this option is only offered if the
+    base system is installable from a CD (image).
 
- -- Frans Pop <fjp@debian.org>  Tue,  4 Apr 2006 18:27:30 +0200
+ -- Frans Pop <fjp@debian.org>  Tue,  4 Apr 2006 21:39:14 +0200
 
 choose-mirror (1.21) unstable; urgency=low
 
Index: debian/choose-mirror.templates.ftp-in
===================================================================
--- debian/choose-mirror.templates.ftp-in	(revision 36101)
+++ debian/choose-mirror.templates.ftp-in	(working copy)
@@ -2,7 +2,7 @@
 
 Template: mirror/ftp/countries
 Type: select
-_Choices: enter information manually
+__Choices: enter information manually
 #  Translators, you should put here the ISO 3166 code of a country
 #  which you know hosts at least one Debian FTP mirror. Please check
 #  that the country really has a Debian FTP mirror before putting a
@@ -19,6 +19,14 @@
  The goal is to find a mirror of the Debian archive that is close to you on the network -- be
  aware that nearby countries, or even your own, may not be the best choice.
 
+Template: mirror/ftp/countries_alt
+Type: select
+__Choices: don't use a network mirror, enter information manually
+_Default: US[ Default value for ftp]
+_Description: Debian archive mirror country:
+ The goal is to find a mirror of the Debian archive that is close to you on the network -- be
+ aware that nearby countries, or even your own, may not be the best choice.
+
 Template: mirror/ftp/mirror
 Type: select
 Choices: ${mirrors}
Index: debian/choose-mirror.templates.http-in
===================================================================
--- debian/choose-mirror.templates.http-in	(revision 36101)
+++ debian/choose-mirror.templates.http-in	(working copy)
@@ -2,7 +2,7 @@
 
 Template: mirror/http/countries
 Type: select
-_Choices: enter information manually
+__Choices: enter information manually
 #  Translators, you should put here the ISO 3166 code of a country
 #  which you know hosts at least one Debian HTTP mirror. Please check
 #  that the country really has a Debian HTTP mirror before putting a
@@ -19,6 +19,14 @@
  The goal is to find a mirror of the Debian archive that is close to you on the network -- be
  aware that nearby countries, or even your own, may not be the best choice.
 
+Template: mirror/http/countries_alt
+Type: select
+__Choices: don't use a network mirror, enter information manually
+_Default: US[ Default value for http]
+_Description: Debian archive mirror country:
+ The goal is to find a mirror of the Debian archive that is close to you on the network -- be
+ aware that nearby countries, or even your own, may not be the best choice.
+
 Template: mirror/http/mirror
 Type: select
 Choices: ${mirrors}

Attachment: pgpW2oHpp7y6L.pgp
Description: PGP signature


Reply to: