Adding support for nameserver in ip= boot parameter.
authorSteven Shiau <steven@nchc.org.tw>
Tue, 14 Aug 2012 18:57:17 +0000 (20:57 +0200)
committerDaniel Baumann <daniel@debian.org>
Tue, 14 Aug 2012 18:57:17 +0000 (20:57 +0200)
scripts/boot/9990-netbase.sh

index c11b9df..384f3f6 100755 (executable)
@@ -16,6 +16,7 @@ Netbase ()
        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 @@ EOF
                        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,15 @@ cat >> "${IFFILE}" << EOF
 EOF
 
                        fi
+
+                       if [ -n "${nameserver}" ]
+                       then
+
+cat >> "${DNSFILE}" << EOF
+nameserver ${nameserver}
+EOF
+
+                       fi
                done
        else
                if [ -z "${NETBOOT}" ] || [ -n "${DHCP}" ]