2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

fix bug 4565

This commit is contained in:
junxiawang 2015-05-22 06:54:55 -04:00
parent e2204267e6
commit e64f3d3dd7

View File

@ -524,6 +524,22 @@ elif [ "$1" = "-s" ];then
str_inst_ip=`grep IPADDR $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"`
str_inst_mask=`grep NETMASK $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"`
str_inst_gateway=`grep GATEWAYS $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"`
else
if [ -n "$MACADDRESS" ];then
str_inst_mac=$MACADDRESS
inst_nic=`ip -o link |grep -i ${str_inst_mac} |awk '{print $2}'|sed 's/://g'`
if [ ! -z "${inst_nic}" ];then
str_inst_ip=`ip -4 -o addr|grep -i ${inst_nic} |awk '{print $4}'|awk -F/ '{print $1}'`
if [ ! -z "str_inst_ip" ];then
inst_ip_pre=`ip ro ls|grep -i ${str_inst_ip}|awk '{print $1}'|awk -F/ '{print $1}'`
if [ ! -z "inst_ip_pre" ];then
str_inst_mask=`route |grep ${inst_ip_pre}|awk '{print $3}'|head -1`
fi
fi
fi
str_inst_gateway=`ip ro ls|grep default|awk '{print $3}'|head -1`
echo "str_inst_gateway is $str_inst_gateway"
fi
fi
else
str_lease_file=`ls /var/lib/dhclient/*$str_inst_nic* | grep leases`