Skip to content

Commit

Permalink
adding parsing NM resolv.conf for dns entries (if there is no lease f…
Browse files Browse the repository at this point in the history
…ile)
  • Loading branch information
sgr authored and Obihoernchen committed May 7, 2024
1 parent 549e6ba commit 7f38dbf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions xCAT/postscripts/configeth
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ elif [ "$1" = "-s" ];then
str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
str_inst_dns=`grep domain-name-servers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
str_inst_dns_search=`grep domain-search $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
else
if [ -n "$MACADDRESS" ];then
str_inst_mac=$MACADDRESS
Expand All @@ -594,6 +595,11 @@ elif [ "$1" = "-s" ];then
fi
fi
str_inst_gateway=`ip ro ls|grep default|awk '{print $3}'|head -1`
str_resolv_file=/var/run/NetworkManager/resolv.conf
if [ -f $str_resolv_file ];then
str_inst_dns=`grep ^nameserver $str_resolv_file | sed 's/^nameserver //g'`
str_inst_dns_search=`grep ^search $str_resolv_file | sed 's/^search //g'`
fi
fi
fi
fi
Expand Down Expand Up @@ -755,6 +761,11 @@ elif [ "$1" = "-s" ];then
nmcli con modify $con_name ipv4.dns ${str_inst_dns}
fi
fi
if [ -n "${str_inst_dns_search}" ];then
if [ $networkmanager_active -eq 1 ]; then
nmcli con modify $con_name ipv4.dns-search "${str_inst_dns_search}"
fi
fi
if [ -n "${str_inst_mtu}" ];then
if [ $networkmanager_active -eq 1 ]; then
nmcli con modify $con_name mtu ${str_inst_mtu}
Expand Down

0 comments on commit 7f38dbf

Please sign in to comment.