Bug#538265: Add disable netcfg preseed option
Package: netcfg
Version: 1.46
Severity: wishlist
Tags: lenny
I have a situation where I want to use a single, custom debian installer 
initrd, but want to preseed network configuration differences between 
production cdrom and development netboot installers.
The systems in the field should not have networking enabled at all. With 
the stock Lenny installer, on systems with wireless cards and no 
proprietary firmware blobs, you get scary red error screens during the 
install complaining about network errors. If you add the firmware blobs 
to the d-i just to shut up the errors, and if the hardware switch is 
turned off, you again get scary red error screens about network errors.
I don't want *any* networking on the cdrom installs, but I also want to 
use a consistent initrd between development and production to avoid 
possible bugs from using different installers.
Enter this patch. It allows me to optionally disable network 
configuration completely via preseed on the cdrom install, but leaves 
the default to enabled for netboot. The attached patch may be a 
horrible, ugly hack based on the d-i design, but it works for me. If you 
don't like this patch, can you add a similar capability going forward?
Thanks!
Tony
diff -urN netcfg-1.46.orig/debian/netcfg-common.templates netcfg-1.46/debian/netcfg-common.templates
--- netcfg-1.46.orig/debian/netcfg-common.templates	2008-08-09 19:34:13.000000000 +0000
+++ netcfg-1.46/debian/netcfg-common.templates	2009-07-24 15:27:30.000000000 +0000
@@ -1,3 +1,12 @@
+Template: netcfg/enable_netcfg
+Type: boolean
+Default: true
+# :sl1:
+_Description: Enable network configuration during Install?
+ This option can be preseeded for cdrom installs and will cause the
+ installer to ignore any network configurations. Note that after the
+ install, the user must manually configure any networking options.
+
 Template: netcfg/use_dhcp
 Type: boolean
 Default: true
Binary files netcfg-1.46.orig/debian/.netcfg-common.templates.swp and netcfg-1.46/debian/.netcfg-common.templates.swp differ
diff -urN netcfg-1.46.orig/netcfg.c netcfg-1.46/netcfg.c
--- netcfg-1.46.orig/netcfg.c	2008-08-09 19:34:15.000000000 +0000
+++ netcfg-1.46/netcfg.c	2009-07-24 15:33:28.000000000 +0000
@@ -78,6 +78,12 @@
     /* initialize debconf */
     client = debconfclient_new();
     debconf_capb(client, "backup");
+
+    /* Check to see if netcfg should be run at all */
+    debconf_get(client, "netcfg/enable_netcfg");
+    if ( strcmp(client->value, "false") == 0 ) {
+        netcfg_write_loopback();
+        return 0;
+    }
     
     /* always always always default back to DHCP, unless you've specified
      * disable_dhcp on the command line. */
Reply to: