From 57f8e18d1700f63b1f0e068d0fe75fa120609be4 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Thu, 12 Jul 2012 11:15:35 +0800 Subject: [PATCH] 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 Acked-by: Vivek Goyal --- dracut-module-setup.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index c1c6929..8dfe207 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -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