network dns config fix

In case explict DNS setup in ifcfg file, we should add proper cmdline
for dracut network use.

Add a kdump_setup_dns function to handle this.
v1->v2: vivek: use echo instead of 'echo -n'

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Dave Young 2012-07-12 11:15:35 +08:00
parent e444daa5ac
commit 57f8e18d17

View File

@ -43,6 +43,14 @@ kdump_is_vlan() {
[ -f /proc/net/vlan/"$1" ]
}
# $1: netdev name
kdump_setup_dns() {
_dnsfile=${initdir}/etc/cmdline.d/42dns.conf
. /etc/sysconfig/network-scripts/ifcfg-$1
[ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile"
[ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
}
#$1: netdev name
#checking /etc/sysconfig/network-scripts/ifcfg-$1,
#if it use static ip echo it, or echo null
@ -142,6 +150,8 @@ kdump_setup_netdev() {
echo -n " ip=${_static}$_netdev:${_proto}" > ${initdir}/etc/cmdline.d/40ip.conf
echo " ifname=$_netdev:$(kdump_get_mac_addr $_netdev)" >> ${initdir}/etc/cmdline.d/40ip.conf
fi
kdump_setup_dns "$_netdev"
}
#Function:kdump_install_net