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

[Patch] Assign nameserver in boot parameter "ip" of live-boot



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- From my understanding, the live-boot now 3.0~a38-1 does not provide a
way to assign DNS server.
Attached please find a patch to allow assigning nameserver in boot
parameter "ip" of live-boot.
The format is:
ip=[DEVICE]:[CLIENT_IP]:[NETMASK]:[GATEWAY_IP]:[NAMESERVER]
[,[DEVICE]:[CLIENT_IP]:[NETMASK]:[GATEWAY_IP]:[NAMESERVER]]
e.g.
ip=eth0:192.168.100.1:255.255.255.0:192.168.100.254:8.8.8.8,eth1:192.168.101.1:255.255.255.0::

My 2 cents.

Steven.

- -- 
Steven Shiau <steven _at_ nchc org tw> <steven _at_ stevenshiau org>
National Center for High-performance Computing, Taiwan.
http://www.nchc.org.tw
Public Key Server PGP Key ID: 1024D/9762755A
Fingerprint: A2A1 08B7 C22C 3D06 34DB  F4BC 08B3 E3D7 9762 755A
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAWif8ACgkQCLPj15didVpoxwCggK4uHJlZpAxl9wvbtZrx3x1+
ts8AnjeWUZOXSkces2H4ngGTAVMr78hh
=GSkh
-----END PGP SIGNATURE-----

--- a/scripts/boot/9990-netbase.sh
+++ b/scripts/boot/9990-netbase.sh
@@ -16,6 +16,7 @@
 	log_begin_msg "Preconfiguring networking"
 
 	IFFILE="/root/etc/network/interfaces"
+	DNSFILE="/root/etc/resolv.conf"
 
 	if [ "${STATICIP}" = "frommedia" ] && [ -e "${IFFILE}" ]
 	then
@@ -43,6 +44,7 @@
 			ifaddress="$(echo ${ifline} | cut -f2 -d ':')"
 			ifnetmask="$(echo ${ifline} | cut -f3 -d ':')"
 			ifgateway="$(echo ${ifline} | cut -f4 -d ':')"
+			nameserver="$(echo ${ifline} | cut -f5 -d ':')"
 
 cat >> "${IFFILE}" << EOF
 allow-hotplug ${ifname}
@@ -60,6 +62,16 @@
 EOF
 
 			fi
+
+			if [ -n "${nameserver}" ]
+			then
+ 
+cat >> "${DNSFILE}" << EOF
+nameserver ${nameserver}
+EOF
+
+			fi
+
 		done
 	else
 		if [ -z "${NETBOOT}" ] || [ -n "${DHCP}" ]

Reply to: