X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Fboot%2F9990-netbase.sh;h=b3f886c943a01e0be7d0513960bce7e4e2936132;hb=acbb276e0708814af39fed5ebb99fc6daca4de65;hp=3f5f7aff1fe04c3c1c8159a6c3ec7be6510e154f;hpb=2e70d7be610c9e45787c37352d36241de3c155d7;p=live-boot-grml.git diff --git a/scripts/boot/9990-netbase.sh b/scripts/boot/9990-netbase.sh index 3f5f7af..b3f886c 100755 --- a/scripts/boot/9990-netbase.sh +++ b/scripts/boot/9990-netbase.sh @@ -11,11 +11,12 @@ Netbase () # FIXME: stop hardcoding overloading of initramfs-tools functions . /scripts/functions - . /lib/live/boot/initramfs-tools.sh + . /lib/live/boot/9990-initramfs-tools.sh 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,17 @@ cat >> "${IFFILE}" << EOF EOF fi + + if [ -n "${nameserver}" ] + then + if [ -e "${DNSFILE}" ] + then + grep -v ^nameserver "${DNSFILE}" > "${DNSFILE}.tmp" + mv "${DNSFILE}.tmp" "${DNSFILE}" + fi + + echo "nameserver ${nameserver}" >> "${DNSFILE}" + fi done else if [ -z "${NETBOOT}" ] || [ -n "${DHCP}" ] @@ -122,20 +135,5 @@ EOF fi fi - #if [ ! -x /root/usr/sbin/NetworkManager ] - #then - # for i in eth0 eth1 eth2 ath0 wlan0 - # do - # grep -q "iface ${i}" ${IFFILE} && continue - # - #cat >> "${IFFILE}" << EOF - #allow-hotplug ${i} - #iface ${i} inet dhcp - # - #EOF - # - # done - #fi - log_end_msg }