mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
Fix nicutils syntax, improve regex
This commit is contained in:
parent
b9baaa9c98
commit
9da20387d7
@ -215,7 +215,7 @@ function configipv4(){
|
||||
do
|
||||
name="${array_extra_param_names[$i]}"
|
||||
value="${array_extra_param_values[$i]}"
|
||||
if [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify $con_name $name $value
|
||||
else
|
||||
grep -i "${name}" $str_conf_file
|
||||
@ -824,7 +824,7 @@ elif [ "$1" = "-s" ];then
|
||||
do
|
||||
name="${array_extra_param_names[$i]}"
|
||||
value="${array_extra_param_values[$i]}"
|
||||
if [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify $con_name $name $value
|
||||
else
|
||||
echo "$i: name=$name value=$value"
|
||||
|
@ -439,7 +439,7 @@ 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
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify $con_name $name $value
|
||||
else
|
||||
grep -i "${name}" $dir/ifcfg-$nic
|
||||
@ -475,7 +475,7 @@ 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
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify $con_name $name $value
|
||||
else
|
||||
grep -i "${name}" $dir/ifcfg-$nic
|
||||
@ -536,7 +536,7 @@ 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
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify $con_name $name $value
|
||||
else
|
||||
grep -i "${name}" $dir/ifcfg-$nic
|
||||
@ -605,7 +605,7 @@ 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
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify $con_name $name $value
|
||||
else
|
||||
grep -i "${name}" $cfgfile
|
||||
@ -788,7 +788,7 @@ then
|
||||
done
|
||||
else
|
||||
if [ $nmcli_used -eq 1 ]; then
|
||||
if ! [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then
|
||||
if ! [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con reload $dir/ifcfg-$nic
|
||||
fi
|
||||
nmcli con up $nic 2>&1
|
||||
|
@ -1809,7 +1809,7 @@ function add_extra_params_nmcli {
|
||||
con_name=$2
|
||||
rc=0
|
||||
|
||||
if ! [[ $OSVER =~ (rhels9|alma9|rocky9) ]]; then
|
||||
if ! [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
str_conf_file="/etc/sysconfig/network-scripts/ifcfg-${con_name}"
|
||||
str_conf_file_1="/etc/sysconfig/network-scripts/ifcfg-${con_name}-1"
|
||||
if [ -f $str_conf_file_1 ]; then
|
||||
@ -1830,7 +1830,7 @@ function add_extra_params_nmcli {
|
||||
|
||||
if [ -n "$name" -a -n "$value" ]; then
|
||||
# For RHEL 9, use nmcli directly, otherwise use ifcfg scheme.
|
||||
if [[ "$OSVER" =~ (rhels9|alma9|rocky9) ]]; then
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify "$con_name" "$name" "$value"
|
||||
rc+=$?
|
||||
else
|
||||
@ -1849,7 +1849,7 @@ function add_extra_params_nmcli {
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
if [[ $OSVER != (rhels9|alma9|rocky9) ]]; then
|
||||
if [[ ! "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
$nmcli con reload $str_conf_file
|
||||
fi
|
||||
return $rc
|
||||
|
Loading…
x
Reference in New Issue
Block a user