To support site.precreatemypostscripts=1

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13988 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jjhua 2012-10-12 05:43:45 +00:00
parent ad9945e953
commit 5209a92de1

View File

@ -75,6 +75,48 @@ download_postscripts()
return $rc
}
download_mypostscript()
{
server=$1
if [ -z $server ]; then
return 1;
fi
if [ -f /opt/xcat/xcatinfo ]; then
TFTPDIR=`grep 'TFTPDIR' /opt/xcat/xcatinfo |cut -d= -f2`
fi
if [ -z "$TFTPDIR" ]; then
TFTPDIR="/tftpboot"
fi
max_retries=2
retry=0
rc=1
node=`hostname`
while [ 0 -eq 0 ]; do
wget -N --waitretry=10 --random-wait -T 60 http://$server$TFTPDIR/mypostscripts/mypostscript.$node -P /xcatpost 2> /tmp/wget.log
rc=$?
if [ $rc -eq 0 ]; then
mv /xcatpost/mypostscript.$node /xcatpost/mypostscript
return 0;
fi
retry=$(($retry+1))
if [ $retry -eq $max_retries ]; then
break
fi
SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*5)}')
sleep $SLI
done
return $rc
}
# parse the arguments
ARGNUM=$#;
if [ -z $1 ]; then
@ -243,6 +285,13 @@ else # for common mode
fi # finish the postscripts download
rm -rf /xcatpost/mypostscript
download_mypostscript $SIP
if grep 'rw /rw tmpfs ' /proc/mounts >/dev/null 2>&1; then
touch /var/lock/subsys/xcatmounts
echo '#!/bin/bash' > /etc/rc6.d/K10xcatmounts
@ -269,6 +318,9 @@ if [ -x /usr/bin/openssl ]; then
export USEOPENSSLFORXCAT
fi
if [ ! -x /xcatpost/mypostscript ]; then
/xcatpost/getpostscript.awk | egrep '<data>' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript;
MYCONT=`grep MASTER /xcatpost/mypostscript`
#echo "MYCONT=$MYCONT"
@ -297,6 +349,8 @@ while [ -z "$MYCONT" ]; do
fi
done
fi
#save the MASTER into the xcatinfo file for node deployment case,
#for updatenode case, only save it when -M is specified
if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "4" ]; then