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

Bug#538265: Add disable netcfg preseed option



Oops! I used the wrong preseed hostname value in my last diff. The correct value is get_hostname not dhcp_hostname. I've updated the patch.

On Fri, Jul 24, 2009 at 2:19 AM, Otavio Salvador wrote
> Please also provide a patch for the installation guide to document the
> new option.

I've downloaded the installation-guide package and looked for other, similar configuration settings. It seemed like the most obvious spot was in the debconf variable example here:

http://d-i.alioth.debian.org/manual/en.i386/apbs04.html

The attached diff puts the netcfg/enable option at the top of the list with an explanation and left it commented out.

T

diff -urN netcfg-1.46.orig/debian/netcfg-common.templates netcfg-1.46.nosvn/debian/netcfg-common.templates
--- netcfg-1.46.orig/debian/netcfg-common.templates	2008-08-09 19:34:13.000000000 +0000
+++ netcfg-1.46.nosvn/debian/netcfg-common.templates	2009-07-25 13:46:17.000000000 +0000
@@ -1,3 +1,9 @@
+Template: netcfg/enable
+Type: boolean
+Default: true
+Description: for internal use; can be preseeded
+ Set to false to disable netcfg entirely via preseed.
+
 Template: netcfg/use_dhcp
 Type: boolean
 Default: true
diff -urN netcfg-1.46.orig/netcfg.c netcfg-1.46.nosvn/netcfg.c
--- netcfg-1.46.orig/netcfg.c	2008-08-09 19:34:15.000000000 +0000
+++ netcfg-1.46.nosvn/netcfg.c	2009-07-25 13:46:17.000000000 +0000
@@ -78,6 +78,19 @@
     /* initialize debconf */
     client = debconfclient_new();
     debconf_capb(client, "backup");
+
+    /* Check to see if netcfg should be run at all */
+    debconf_get(client, "netcfg/enable");
+    if ( strcmp(client->value, "false") == 0 ) {
+        struct in_addr null_ipaddress;
+        char *hostname = NULL;
+
+        null_ipaddress.s_addr = 0;
+        netcfg_get_hostname(client, "netcfg/get_hostname", &hostname, 0);
+
+        netcfg_write_common(null_ipaddress, hostname, NULL);
+        return 0;
+    }
     
     /* always always always default back to DHCP, unless you've specified
      * disable_dhcp on the command line. */
diff -urN installation-guide-20081208lenny1.orig/en/appendix/preseed.xml installation-guide-20081208lenny1/en/appendix/preseed.xml
--- installation-guide-20081208lenny1.orig/en/appendix/preseed.xml	2009-07-25 14:38:05.000000000 +0000
+++ installation-guide-20081208lenny1/en/appendix/preseed.xml	2009-07-25 14:38:07.000000000 +0000
@@ -800,6 +800,11 @@
 </para>
 
 <informalexample role="example"><screen>
+# Disable network configuration entirely. This is useful for cdrom
+# installations on non-networked devices where the network questions,
+# warning and long timeouts are a nuisance.
+#d-i netcfg/enable boolean false
+
 # netcfg will choose an interface that has link if possible. This makes it
 # skip displaying a list if there is more than one interface.
 d-i netcfg/choose_interface select auto

Reply to: