diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index b6ecac289f..56e344a998 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -439,12 +439,16 @@ IPADDR=$nicip" > $dir/ifcfg-$nic name="${array_extra_param_names[$i]}" value="${array_extra_param_values[$i]}" echo " $i: name=$name value=$value" + if [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then + nmcli con modify $con_name $name $value + else grep -i "${name}" $dir/ifcfg-$nic if [ $? -eq 0 ];then sed -i "s/.*${name}.*/${name}=${value}/i" >> $dir/ifcfg-$nic else echo "${name}=${value}" >> $dir/ifcfg-$nic fi + fi i=$((i+1)) done else # not the first ip address @@ -471,12 +475,16 @@ IPADDR_$ipindex=$nicip" >> $dir/ifcfg-$nic name="${array_extra_param_names[$i]}" value="${array_extra_param_values[$i]}" echo " $i: name=$name value=$value" + if [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then + nmcli con modify $con_name $name $value + else grep -i "${name}" $dir/ifcfg-$nic if [ $? -eq 0 ];then sed -i "s/.*${name}.*/${name}=${value}/i" >> $dir/ifcfg-$nic else echo "${name}=${value}" >> $dir/ifcfg-$nic fi + fi i=$((i+1)) done fi # end if [ $ipindex -eq 1 ] @@ -528,12 +536,16 @@ IPADDR=$nicip" > $dir/ifcfg-$nic name="${array_extra_param_names[$i]}" value="${array_extra_param_values[$i]}" echo " $i: name=$name value=$value" + if [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then + nmcli con modify $con_name $name $value + else grep -i "${name}" $dir/ifcfg-$nic if [ $? -eq 0 ];then sed -i "s/.*${name}.*/${name}=${value}/i" >> $dir/ifcfg-$nic else echo "${name}=${value}" >> $dir/ifcfg-$nic fi + fi i=$((i+1)) done else # not the first ip address @@ -593,12 +605,16 @@ IPADDR$ipindex=$nicip" name="${array_extra_param_names[$i]}" value="${array_extra_param_values[$i]}" echo " $i: name=$name value=$value" + if [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then + nmcli con modify $con_name $name $value + else grep -i "${name}" $cfgfile if [ $? -eq 0 ];then sed -i "s/.*${name}.*/${name}=${value}/i" >> $cfgfile else echo "${name}=${value}" >> $cfgfile fi + fi i=$((i+1)) done @@ -772,7 +788,9 @@ then done else if [ $nmcli_used -eq 1 ]; then - nmcli con reload $dir/ifcfg-$nic + if ! [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then + nmcli con reload $dir/ifcfg-$nic + fi nmcli con up $nic 2>&1 else ifup $nic > /dev/null 2>&1