From 0d6ee2b95849748755acbb34cc22c0921a2c7d7e Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 30 Dec 2010 09:10:11 +0000 Subject: [PATCH] fix for bug 3148030: setbootfromnet handle the xcatmaster= git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8530 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/setbootfromnet | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/setbootfromnet b/xCAT/postscripts/setbootfromnet index 0e016715d..06105cb59 100755 --- a/xCAT/postscripts/setbootfromnet +++ b/xCAT/postscripts/setbootfromnet @@ -14,10 +14,35 @@ # #----------------------------------------------------------------------------- NODE_NAME=$NODE -SERVER_IP=$MASTER GATE_WAY=$GATEWAY OS=`uname` +if [ -z $MASTER ]; then + msg="$0: The environment variable MASTER is null, pls check.\n" + echo $msg + logger -t xcat "$msg" + exit 1 +fi + +SERVER_IP=`echo $MASTER | grep -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'` +if [ ! -z $SERVER_IP ]; then + SERVER_IP=$MASTER +else + if [[ $OS = "Linux" ]]; then + SERVER_IP=`ping -c 3 $MASTER | sed '/icmp_seq/!d;s/.*(\([0-9.]\+\)).*/\1/' | uniq 2>&1` + SRET=`echo $?` + else ## for AIX + SERVER_IP=`ping -c 3 $MASTER | grep "icmp_seq" | sed 's/.*from \([0-9.]*\):.*/\1/' | uniq 2>&1` + SRET=`echo $?` + fi + if [ $SRET -ne 0 ]; then + msg="$0: The returned value is not correct, server_ip=$SERVER_IP\n" + echo $msg + logger -t xcat "$msg" + exit 1 + fi +fi + if [ ! -z $NODE_NAME ]; then if [[ $OS = "Linux" ]]; then CLIENT_IP=`ping -c 3 $NODE_NAME | sed '/icmp_seq/!d;s/.*(\([0-9.]\+\)).*/\1/' | uniq 2>&1`