mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 17:23:08 +00:00
Merge pull request #5444 from stanford-rc/hardeths_gw
hardeths: avoid duplicate GATEWAY entries in /etc/sysconfig/network
This commit is contained in:
commit
199d5c35c1
@ -50,7 +50,7 @@ if [ -f /etc/os-release ] && (cat /etc/os-release |grep -i '^NAME=[ "]*Cumulus
|
||||
OSVER="cumulus"
|
||||
fi
|
||||
|
||||
defgw=`ip route | grep default | awk '{print $3}'`
|
||||
defgw=`ip route | grep default | awk '{print $3}' | head -n1`
|
||||
if ( pmatch $OSVER "ubuntu*" ) || (pmatch $OSVER "cumulus")
|
||||
then
|
||||
echo `hostname` >/etc/hostname
|
||||
@ -73,7 +73,9 @@ else
|
||||
sed -i "s/HOSTNAME.*/HOSTNAME=`hostname`/" /etc/sysconfig/network
|
||||
fi
|
||||
if [ ! -z "$defgw" ]; then
|
||||
echo "GATEWAY=$defgw" >> /etc/sysconfig/network
|
||||
grep -qw GATEWAY /etc/sysconfig/network && \
|
||||
sed -i "s/^GATEWAY.*/GATEWAY=$defgw/" /etc/sysconfig/network || \
|
||||
echo "GATEWAY=$defgw" >> /etc/sysconfig/network
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user