mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
reduce if/else times
This commit is contained in:
parent
63625c6aae
commit
d8cb9b5b04
@ -533,7 +533,6 @@ IPV6ADDR=$nicip/$netmask" >> $dir/ifcfg-$nic
|
||||
echo "IPV6_DEFAULTGW=$gateway" >> $dir/ifcfg-$nic
|
||||
fi
|
||||
else # ipv4 address
|
||||
cfgfile=$dir"/ifcfg-"$nic
|
||||
if [ $nmcli_used -eq 0 ]; then
|
||||
cfgfile=$dir"/ifcfg-"$nic":"$ipindex
|
||||
cfgcontent= "DEVICE=$nic:$ipindex
|
||||
@ -541,15 +540,12 @@ NM_CONTROLLED=no
|
||||
BOOTPROTO=none
|
||||
ONBOOT=yes
|
||||
NETMASK=$netmask
|
||||
IPADDR=$nicip
|
||||
DEVICE=$nic:$ipindex"
|
||||
IPADDR=$nicip"
|
||||
echo "$cfgcontent" > $cfgfile
|
||||
else
|
||||
cfgfile=$dir"/ifcfg-"$nic
|
||||
cfgcontent="NETMASK$ipindex=$netmask
|
||||
IPADDR$ipindex=$nicip"
|
||||
fi
|
||||
if [ $nmcli_used -eq 0 ]; then
|
||||
echo "$cfgcontent" > $cfgfile
|
||||
else
|
||||
echo "$cfgcontent" >> $cfgfile
|
||||
fi
|
||||
if [[ "$OSVER" == rhels6* ]]
|
||||
|
@ -1580,7 +1580,8 @@ function decode_arguments {
|
||||
###############################################################################
|
||||
#
|
||||
# check NetworkManager
|
||||
# output: 2 error
|
||||
# output: 3 error
|
||||
# 2 using NetworkManager but service(systemctl) can not used, this happens in RH8 postscripts
|
||||
# 1 using NetworkManager
|
||||
# 0 using network
|
||||
#
|
||||
@ -1601,7 +1602,7 @@ function check_NetworkManager_or_network_service() {
|
||||
#In RH8 postscripts stage, nmcli can not modify persistent configure file
|
||||
ps -ef|grep -v grep|grep NetworkManager >/dev/null 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
return 0
|
||||
return 2
|
||||
fi
|
||||
checkservicestatus network > /dev/null 2>/dev/null || checkservicestatus wicked > /dev/null 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user