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

Bug#429926: debian-installer: Tries to download files from mirrors when network is not available



Package: debian-installer
Version: 20070308
Priority: wishlist

I've recently tried to setup a Debian 'etch' install using d-i with no
network connection. One of the bugs I've found is that, even if the network
card is down, DNS resolution does not work and the default gateway is not
available, d-i goes and tries to download stuff when I select a mirror 
that I will use (but it is not yet available).

However, since d-i is not able to validate the mirror, the mirror I selected
(based on my location) cannot be set and added to /etc/apt/sources.list.

I think that d-i should (if network is unavailable), just add the mirror to
/etc/apt/sources.list and skip all the validation steps if the user
ackonwledges the fact.

Attached is a crude hack to choose-mirror.c that tries to explain (in code)
what I'm asking for in the bug report, of course, all the code of
check_network() function would have to be implemented.

Regards

Javier
Index: choose-mirror.c
===================================================================
--- choose-mirror.c	(revisión: 47582)
+++ choose-mirror.c	(copia de trabajo)
@@ -575,9 +575,47 @@
 	}
 }
 
+int check_network (void) {
+	char *hostname;
+	char *proxy;
+	char *proxy_hostname;
+	int valid;
+
+	hostname = add_protocol("hostname");
+	debconf_get(debconf, hostname);
+	free(hostname);
+	hostname = strdup(debconf->value);
+	debconf_get(debconf, proxy);
+	if (debconf->value != NULL && strlen(debconf->value)) {
+            /* Copy the value to proxy_hostname without the protocol specification */ 
+        }
+
+        /* Check if the network interface is up */
+
+        /* Check if the default gateway is up */
+
+        /* IF we have a proxy, check if it is reachable */
+            /* IF it is not, prompt a warning */
+
+        /* IF we do not have a proxy, check if the mirror hostname is
+         * reachable */
+
+        /* IF we cannot reach the mirror, ask the user if he wants to continue
+         * without testing the mirror */
+
+        /* Return 100 if the user acknoledges the fact that he has no network
+         * to prevent doing any more checks */
+
+	free(hostname);
+	free(proxy);
+	free(proxy_hostname);
+        return 0;
+}
+
 int main (int argc, char **argv) {
 	/* Use a state machine with a function to run in each state */
 	int state = 0;
+	int state_return = 0;
 	int (*states[])() = {
 		check_base_on_cd,
 		choose_protocol,
@@ -587,6 +625,7 @@
 		choose_mirror,
 		choose_proxy,
 		set_proxy,
+                check_network,
 		validate_mirror,
 		choose_suite,
 		get_codename,
@@ -604,10 +643,15 @@
 	di_system_init("choose-mirror");
 
 	while (state >= 0 && states[state]) {
-		if (states[state]() != 0) { /* back up to start */
-			state = 0;
+                state_return = states[state]();
+		if (state_return != 0) { 
+		    if (state_return == 100 ) { /* do not do more checks */
+			state = state + 5; /* go to the end of the list */
+                    } else { 
+			state = 0; /* back up to start */
+                    }
 		}
-		else if (debconf_go(debconf)) { /* back up */
+                else if (debconf_go(debconf)) { /* back up */
 			state = state - 1;
 		}
 		else {

Attachment: signature.asc
Description: Digital signature


Reply to: