From 488777801455d7a663c1bbd167abcb0236619098 Mon Sep 17 00:00:00 2001 From: phamt Date: Tue, 24 Aug 2010 03:08:19 +0000 Subject: [PATCH] Added postscript support to zvm. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7195 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../xcat/install/scripts/post.rhel5.s390x | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x index 9dc312a87..1031dd65b 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x @@ -1,32 +1,38 @@ echo ARP=no >> /etc/sysconfig/network-scripts/ifcfg-eth0 -# Get node hostname -HOSTNAME=$(hostname -s) +# Get hostname +export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}') +hostname $HOSTNAME -# These variables are set by nodeset +# Run xcat postscripts +# Master/service node set by nodeset export MASTER_IPS=( replace_master ) +export MASTER=replace_master +cd /tmp +RAND=$(perl -e 'print int(rand(50)). "\n"') +sleep $RAND +# Loop through the master/service nodes for i in $(seq 1 20) do GOTIT=0 - - # Loop through the master/service nodes for i in $MASTER_IPS do # Download postscripts from FTP server wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts if [ "$?" = "0" ]; then # Exit if openssl is not executable - if [ ! -x /usr/bin/openssl ]; then - exit 1 + if [ ! -x /usr/bin/openssl ]; then + exit 1 fi - + + USEOPENSSLFORXCAT=1 + export USEOPENSSLFORXCAT + # Get xcat server XCATSERVER=$i:3001 export XCATSERVER - USEOPENSSLFORXCAT=1 - export USEOPENSSLFORXCAT - + # Move postscritps into /xcatpost mv $i/postscripts /xcatpost # Remove postscritps @@ -37,23 +43,24 @@ do # Get postscript to run on this node from xcat server /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript MYCONT=`grep MASTER /tmp/mypostscript` - MAX_RETRIES=10 + MAX_RETRIES=10 RETRY=0 while [ -z "$MYCONT" ]; do RETRY=$(($RETRY+1)) - if [ $RETRY -eq $MAX_RETRIES ]; then + if [ $RETRY -eq $MAX_RETRIES ] + then break fi - # Sleep a couple of seconds before trying again + # Sleep a couple of seconds before trying again let SLI=$RANDOM%10+10 sleep $SLI - + # Get postscript to run on this node from xcat server /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript MYCONT=`grep MASTER /tmp/mypostscript` done - + # Make executable chmod +x /tmp/mypostscript GOTIT=1 @@ -68,18 +75,15 @@ do mkdir -p /opt/xcat touch /opt/xcat/xcatinfo fi - echo "XCATSERVER=$i" > /opt/xcat/xcatinfo - break + break fi - - # Sleep for a couple of seconds RAND=$(perl -e 'print int(rand(5)). "\n"') sleep $RAND done -PATH=/xcatpost:$PATH -export PATH +cd /xcatpost +export PATH=/xcatpost:$PATH # Save post boot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` @@ -88,34 +92,30 @@ chmod 755 /tmp/mypostscript.post # Create post init cat >/etc/init.d/xcatpostinit1 << 'EOF' -# Install directory variable is set by nodeset +# Install directory variable set by nodeset replace_install_dir/postscripts/xcatpostinit1 EOF # Change permissions chmod 755 /etc/init.d/xcatpostinit1 -ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc3.d/S84xcatpostinit1 -ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc4.d/S84xcatpostinit1 -ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1 -# Create post install +# Create post install mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' -# Install directory variable is set by nodeset +# Install directory variable set by nodeset replace_install_dir/postscripts/xcatinstallpost chkconfig xcatpostinit1 off EOF -# Change permissions chmod 755 /opt/xcat/xcatinstallpost chkconfig --add xcatpostinit1 -# Only run prebooot scripts here +# Only run preboot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript - -# Run postscripts /tmp/mypostscript -# Master node is set by nodeset +# Master/service node variable set by nodeset updateflag.awk replace_master 3002 -cd / \ No newline at end of file +cd / + +exit 0 \ No newline at end of file