Skip to content

Commit

Permalink
configib: use nmcli calls for el9
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrichert committed Jun 24, 2024
1 parent 9fb4079 commit 25d7ef4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion xCAT/postscripts/configib
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 25d7ef4

Please sign in to comment.