Skip to content

Commit 0f95df1

Browse files
sgrObihoernchen
authored andcommitted
adding parsing NM resolv.conf for dns entries (if there is no lease file)
1 parent 549e6ba commit 0f95df1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

xCAT/postscripts/configeth

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ elif [ "$1" = "-s" ];then
580580
str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
581581
str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
582582
str_inst_dns=`grep domain-name-servers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
583+
str_inst_dns_search=`grep domain-search $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
583584
else
584585
if [ -n "$MACADDRESS" ];then
585586
str_inst_mac=$MACADDRESS
@@ -594,6 +595,11 @@ elif [ "$1" = "-s" ];then
594595
fi
595596
fi
596597
str_inst_gateway=`ip ro ls|grep default|awk '{print $3}'|head -1`
598+
str_resolv_file=/var/run/NetworkManager/resolv.conf
599+
if [ -f $str_resolv_file ];then
600+
str_inst_dns=`grep ^nameserver $str_resolv_file | sed 's/^nameserver //g'`
601+
str_inst_dns_search=`grep ^search $str_resolv_file | sed 's/^search //g'`
602+
fi
597603
fi
598604
fi
599605
fi
@@ -755,6 +761,11 @@ elif [ "$1" = "-s" ];then
755761
nmcli con modify $con_name ipv4.dns ${str_inst_dns}
756762
fi
757763
fi
764+
if [ -n "${str_inst_dns_search}" ];then
765+
if [ $networkmanager_active -eq 1 ]; then
766+
nmcli con modify $con_name ipv4.dns-search "${str_inst_dns_search}"
767+
fi
768+
fi
758769
if [ -n "${str_inst_mtu}" ];then
759770
if [ $networkmanager_active -eq 1 ]; then
760771
nmcli con modify $con_name mtu ${str_inst_mtu}

0 commit comments

Comments
 (0)