diff --git a/xCAT-server/share/xcat/install/scripts/post.debian b/xCAT-server/share/xcat/install/scripts/post.debian index f8985ad09..740185945 100644 --- a/xCAT-server/share/xcat/install/scripts/post.debian +++ b/xCAT-server/share/xcat/install/scripts/post.debian @@ -90,6 +90,8 @@ do touch /opt/xcat/xcatinfo fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + NODE=#TABLE:nodelist:THISNODE:node# + echo "NODE=$NODE" >> /opt/xcat/xcatinfo break fi RAND=$(perl -e 'print int(rand(5)). "\n"') @@ -99,7 +101,7 @@ cd /xcatpost #gunzip xcatpost.tar.gz #tar -xvf xcatpost.tar #/xcatpost/#TABLE:nodelist:THISNODE:node# -export PATH=/xcatpost:$PATH +export PATH=$PATH:/xcatpost #save the postboot scripts to /var/tmp/mypostscript.post # diff --git a/xCAT-server/share/xcat/install/scripts/post.esx b/xCAT-server/share/xcat/install/scripts/post.esx index 7f5f639f2..ba5911f67 100644 --- a/xCAT-server/share/xcat/install/scripts/post.esx +++ b/xCAT-server/share/xcat/install/scripts/post.esx @@ -40,7 +40,7 @@ ifconfig cat /etc/resolv.conf mount $MASTER_IP:/install/postscripts /xcatpost cd /xcatpost -export PATH=/xcatpost:$PATH +export PATH=$PATH:/xcatpost export NODE=#TABLE:nodelist:THISNODE:node# export OSVER=#TABLE:nodetype:THISNODE:os# export ARCH=#TABLE:nodetype:THISNODE:arch# diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x index 8d44ab030..26fc7fbf9 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x @@ -82,7 +82,9 @@ do touch /opt/xcat/xcatinfo fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo - echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo + echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo + NODE=#TABLE:nodelist:THISNODE:node# + echo "NODE=$NODE" >> /opt/xcat/xcatinfo break fi RAND=$(perl -e 'print int(rand(5)). "\n"') @@ -90,7 +92,7 @@ do done cd /xcatpost -export PATH=/xcatpost:$PATH +export PATH=$PATH:/xcatpost # Use the run_ps subroutine to run the postscripts TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript` diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x index f3ca7035e..2ec7f9963 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x @@ -82,14 +82,16 @@ do touch /opt/xcat/xcatinfo fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo - break + NODE=#TABLE:nodelist:THISNODE:node# + echo "NODE=$NODE" >> /opt/xcat/xcatinfo + break fi RAND=$(perl -e 'print int(rand(5)). "\n"') sleep $RAND done cd /xcatpost -export PATH=/xcatpost:$PATH +export PATH=$PATH:/xcatpost # Use the run_ps subroutine to run the postscripts TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript` diff --git a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x index 319f7f7bb..3658e06bb 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x @@ -88,6 +88,8 @@ do echo "XCATSERVER=$i" > /opt/xcat/xcatinfo echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo + NODE=#TABLE:nodelist:THISNODE:node# + echo "NODE=$NODE" >> /opt/xcat/xcatinfo break fi @@ -96,7 +98,7 @@ do sleep $RAND done -PATH=/xcatpost:$PATH +PATH=$PATH:/xcatpost export PATH # use the run_ps subroutine to run the postscripts diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x index 176d17858..bedb9a6b8 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x @@ -89,6 +89,8 @@ do echo "XCATSERVER=$i" > /opt/xcat/xcatinfo echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo + NODE=#TABLE:nodelist:THISNODE:node# + echo "NODE=$NODE" >> /opt/xcat/xcatinfo break fi @@ -97,7 +99,7 @@ do sleep $RAND done -PATH=/xcatpost:$PATH +PATH=$PATH:/xcatpost export PATH # use the run_ps subroutine to run the postscripts diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index a118ff20b..aae157b1d 100644 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -90,6 +90,8 @@ do touch /opt/xcat/xcatinfo fi echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + NODE=#TABLE:nodelist:THISNODE:node# + echo "NODE=$NODE" >> /opt/xcat/xcatinfo break fi RAND=$(perl -e 'print int(rand(5)). "\n"') @@ -99,7 +101,7 @@ cd /xcatpost #gunzip xcatpost.tar.gz #tar -xvf xcatpost.tar #/xcatpost/#TABLE:nodelist:THISNODE:node# -export PATH=/xcatpost:$PATH +export PATH=$PATH:/xcatpost #save the postboot scripts to /var/tmp/mypostscript.post # diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index dd16fa716..977df68c9 100644 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -98,12 +98,15 @@ do sleep $RAND done echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo +NODE=#TABLE:nodelist:THISNODE:node# +echo "NODE=$NODE" >> /opt/xcat/xcatinfo + #echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo cd /xcatpost #gunzip xcatpost.tar.gz #tar -xvf xcatpost.tar #/xcatpost/#TABLE:nodelist:THISNODE:node# -export PATH=/xcatpost:$PATH +export PATH=$PATH:/xcatpost # use the run_ps subroutine to run the postscripts TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript` diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index acb6e8505..822fc1e17 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html ##################################################### # @@ -341,10 +341,38 @@ fi # finish the postscripts download rm -rf /xcatpost/mypostscript -node=`hostname --short` +#get node name +if [ -f /opt/xcat/xcatinfo ]; then + node=`grep 'NODE' /opt/xcat/xcatinfo |cut -d= -f2` +fi + +#try to get the node ip address that connects to the server. +#then resolve the name of the ip +if [ -z "$node" ]; then + #find out the ip address of the node for the management nic + NIP=`ip route get $SIP | head -n 1 | sed 's/^.*src//g' | awk {'print $1'} +` + if [ -n "$NIP" ]; then + #relsove the name of the node from ip address + node=`host $NIP | awk {'print $5'} | sed '$s/\.$//'` + fi +fi + +if [ -z "$node" ]; then + node=`hostname` +fi + +#try the short name first +node_short=`echo $node |awk -F. {'print $1'}` max_retries=2 postfix=0 -download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR +download_mypostscript $SIP $node_short $postfix $max_retries $TFTPDIR +if [ $? -ne 0 ]; then + if [ "$node" != "node_short" ]; then + download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR + fi +fi + @@ -383,6 +411,11 @@ if [ ! -x /xcatpost/mypostscript ]; then max_retries=1 postfix=1 download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR +if [ $? -ne 0 ]; then + if [ "$node" != "node_short" ]; then + download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR + fi +fi MYCONT=`grep MASTER /xcatpost/mypostscript` #echo "MYCONT=$MYCONT" @@ -409,7 +442,11 @@ while [ -z "$MYCONT" ]; do max_retries=1 postfix=1 download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR - + if [ $? -ne 0 ]; then + if [ "$node" != "node_short" ]; then + download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR + fi + fi MYCONT=`grep MASTER /xcatpost/mypostscript` if [ ! -z "$MYCONT" ]; then break; @@ -435,7 +472,21 @@ if [ -n "$new_ms" ]; then echo "XCATSERVER=$new_ms" >> /opt/xcat/xcatinfo fi fi - + +#save the NODE into xcatinfo +new_node=`grep '^NODE=' /xcatpost/mypostscript |cut -d= -f2` +if [ -n "$new_node" ]; then + if [ ! -f /opt/xcat/xcatinfo ]; then + mkdir -p /opt/xcat + touch /opt/xcat/xcatinfo + fi + grep '^NODE=' /opt/xcat/xcatinfo 2>&1 > /dev/null + if [ $? -eq 0 ]; then + sed -i "s/NODE=.*/NODE=$new_node/" /opt/xcat/xcatinfo + else + echo "NODE=$new_node" >> /opt/xcat/xcatinfo + fi +fi # when called by the updatenode command #modify the UPDATENODE flag to 1