From b397bb7c1953419162639308f3d70d6a1ddc9213 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 30 Jan 2014 17:12:24 +0100 Subject: [PATCH] network/ifup.sh: handle $dns1 and $dns2 from "ip=" settings --- dracut.cmdline.7.asc | 7 +++++++ modules.d/40network/ifup.sh | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc index 963ba07..985285b 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -472,6 +472,13 @@ cannot be used in conjunction with the **ifname** argument for the same . ===================== +**ip=**____:[____]:____:____:____:____:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[____][:____]]:: + explicit network configuration. If you want do define a IPv6 address, put it + in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple + times. ____ is optional and is the address of the remote endpoint + for pointopoint interfaces and it may be followed by a slash and a decimal + number, encoding the network prefix length. + **ifname=**____:____:: Assign network device name (ie "bootnet") to the NIC with MAC . diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh index 2edcfe6..b33981b 100755 --- a/modules.d/40network/ifup.sh +++ b/modules.d/40network/ifup.sh @@ -264,18 +264,15 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then ip link set "$vlanname" up fi -# setup nameserver -namesrv=$(getargs nameserver) -if [ -n "$namesrv" ] ; then - for s in $namesrv; do - echo nameserver $s - done -fi >> /tmp/net.$netif.resolv.conf - # No ip lines default to dhcp ip=$(getarg ip) if [ -z "$ip" ]; then + namesrv=$(getargs nameserver) + for s in $namesrv; do + echo nameserver $s >> /tmp/net.$netif.resolv.conf + done + if [ "$netroot" = "dhcp6" ]; then do_dhcp -6 else @@ -307,8 +304,14 @@ for p in $(getargs ip=); do [ "$use_bridge" != 'true' ] && \ [ "$use_vlan" != 'true' ] && continue + # setup nameserver + namesrv="$dns1 $dns2 $(getargs nameserver)" + for s in $namesrv; do + echo nameserver $s >> /tmp/net.$netif.resolv.conf + done + # Store config for later use - for i in ip srv gw mask hostname macaddr; do + for i in ip srv gw mask hostname macaddr dns1 dns2; do eval '[ "$'$i'" ] && echo '$i'="$'$i'"' done > /tmp/net.$netif.override