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

Bug#275360: [Patch] example patch showing where to hook dhcp network config to get dhcp->static config



On 04/01/07, Alex Owen <r.alex.owen@gmail.com> wrote:
This patch is in a VERY EARLY state. It inserts into
/etc/dhclient-script so that the ip/mask/route etc form dhcp can be
captured. This then needs to be put into the debconf database. this
will allow  development of static net config from a dhcp boot.

The patch writes debconf-set statements to a file which could later be
sourced to set the values in debconf-db

Opps... here is the patch
Index: packages/netcfg/dhclient-script
===================================================================
--- packages/netcfg/dhclient-script	(revision 43848)
+++ packages/netcfg/dhclient-script	(working copy)
@@ -89,6 +89,16 @@
         # Get the domain name into a file suitable for netcfg to read.
         echo -n "$new_domain_name" > /tmp/domain_name
 
+	# copy DHCP information into debconf database (wishlist #275360)
+	#this does not fully work but I think this is the place to hook the dhcp process
+        echo /bin/debconf-set netcfg/get_ipaddress '"'"$new_ip_address"'"' >/tmp/net.preseed
+        echo /bin/debconf-set netcfg/get_netmask   '"'"$new_mask"'"' >>/tmp/net.preseed
+        for router in $new_routers; do
+                echo /bin/debconf-set netcfg/get_gateway '"'"$router"'"' >>/tmp/net.preseed
+                break
+        done
+        echo /bin/debconf-set netcfg/get_nameservers '"'"$new_domain_name_servers"'"' >>/tmp/net.preseed
+
         ;;
 
     EXPIRE|FAIL|RELEASE|STOP)

Reply to: