diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm
index 807648b42..5a3f99746 100644
--- a/xCAT-server/lib/xcat/plugins/zvm.pm
+++ b/xCAT-server/lib/xcat/plugins/zvm.pm
@@ -3074,7 +3074,7 @@ sub nodeSet {
}
$out =
-`sed --in-place -e "s,replace_host_address,$hostIP,g" \ -e "s,replace_long_name,$hostname,g" \ -e "s,replace_short_name,$node,g" \ -e "s,replace_domain,$domain,g" \ -e "s,replace_hostname,$node,g" \ -e "s,replace_nameserver,$nameserver,g" \ -e "s,replace_broadcast,$broadcast,g" \ -e "s,replace_device,$device,g" \ -e "s,replace_ipaddr,$hostIP,g" \ -e "s,replace_lladdr,$mac,g" \ -e "s,replace_netmask,$mask,g" \ -e "s,replace_network,$network,g" \ -e "s,replace_ccw_chan_ids,$chanIds,g" \ -e "s,replace_ccw_chan_mode,FOOBAR,g" \ -e "s,replace_gateway,$gateway,g" \ -e "s,replace_root_password,$passwd,g" \ -e "s,replace_nic_addr,$readChannel,g" $customTmpl`;
+`sed --in-place -e "s,replace_host_address,$hostIP,g" \ -e "s,replace_long_name,$hostname,g" \ -e "s,replace_short_name,$node,g" \ -e "s,replace_domain,$domain,g" \ -e "s,replace_hostname,$node,g" \ -e "s,replace_nameserver,$nameserver,g" \ -e "s,replace_broadcast,$broadcast,g" \ -e "s,replace_device,$device,g" \ -e "s,replace_ipaddr,$hostIP,g" \ -e "s,replace_lladdr,$mac,g" \ -e "s,replace_netmask,$mask,g" \ -e "s,replace_network,$network,g" \ -e "s,replace_ccw_chan_ids,$chanIds,g" \ -e "s,replace_ccw_chan_mode,FOOBAR,g" \ -e "s,replace_gateway,$gateway,g" \ -e "s,replace_root_password,$passwd,g" \ -e "s,replace_nic_addr,$readChannel,g" \ -e "s,replace_master,$master,g" \ -e "s,replace_install_dir,$installDir,g" $customTmpl`;
# Read sample parmfile in /install/sles10.2/s390x/1/boot/s390x/
$sampleParm = "$installDir/$os/s390x/1/boot/s390x/parmfile";
@@ -3197,7 +3197,7 @@ sub nodeSet {
# Edit template
my $url = "ftp://$ftp/$os/s390x/";
$out =
-`sed --in-place -e "s,replace_url,$url,g" \ -e "s,replace_ip,$hostIP,g" \ -e "s,replace_netmask,$mask,g" \ -e "s,replace_gateway,$gateway,g" \ -e "s,replace_nameserver,$nameserver,g" \ -e "s,replace_hostname,$hostname,g" \ -e "s,replace_rootpw,$passwd,g" $customTmpl`;
+`sed --in-place -e "s,replace_url,$url,g" \ -e "s,replace_ip,$hostIP,g" \ -e "s,replace_netmask,$mask,g" \ -e "s,replace_gateway,$gateway,g" \ -e "s,replace_nameserver,$nameserver,g" \ -e "s,replace_hostname,$hostname,g" \ -e "s,replace_rootpw,$passwd,g" \ -e "s,replace_master,$master,g" \ -e "s,replace_install_dir,$installDir,g" $customTmpl`;
# Read sample parmfile in /install/rhel5.3/s390x/images
$sampleParm = "$installDir/$os/s390x/images/generic.prm";
diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x
index d4ea0f703..9dc312a87 100644
--- a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x
+++ b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x
@@ -1 +1,121 @@
-echo ARP=no >> /etc/sysconfig/network-scripts/ifcfg-eth0
\ No newline at end of file
+echo ARP=no >> /etc/sysconfig/network-scripts/ifcfg-eth0
+
+# Get node hostname
+HOSTNAME=$(hostname -s)
+
+# These variables are set by nodeset
+export MASTER_IPS=( replace_master )
+
+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
+ fi
+
+ # Get xcat server
+ XCATSERVER=$i:3001
+ export XCATSERVER
+ USEOPENSSLFORXCAT=1
+ export USEOPENSSLFORXCAT
+
+ # Move postscritps into /xcatpost
+ mv $i/postscripts /xcatpost
+ # Remove postscritps
+ rm -rf $i
+ # Make postscripts executable
+ chmod +x /xcatpost/*
+
+ # 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
+ RETRY=0
+ while [ -z "$MYCONT" ]; do
+ RETRY=$(($RETRY+1))
+ if [ $RETRY -eq $MAX_RETRIES ]; then
+ break
+ fi
+
+ # 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
+ break
+ fi
+ done
+
+ # If postscripts for this node are found
+ if [ "$GOTIT" = "1" ]; then
+ # Save the master/service node to /opt/xcat/xcatinfo file
+ if [ ! -f /opt/xcat/xcatinfo ]; then
+ mkdir -p /opt/xcat
+ touch /opt/xcat/xcatinfo
+ fi
+
+ echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
+ break
+ fi
+
+ # Sleep for a couple of seconds
+ RAND=$(perl -e 'print int(rand(5)). "\n"')
+ sleep $RAND
+done
+
+PATH=/xcatpost:$PATH
+export PATH
+
+# Save post boot scripts to /tmp/mypostscript.post
+TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
+echo "$TMP" > /tmp/mypostscript.post
+chmod 755 /tmp/mypostscript.post
+
+# Create post init
+cat >/etc/init.d/xcatpostinit1 << 'EOF'
+# Install directory variable is 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
+mkdir -p /opt/xcat
+cat >/opt/xcat/xcatinstallpost << 'EOF'
+# Install directory variable is 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
+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
+updateflag.awk replace_master 3002
+cd /
\ No newline at end of file
diff --git a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x
index 23b3ed55d..f87c17be0 100644
--- a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x
+++ b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x
@@ -3,20 +3,140 @@
post.sh
shell
- /tmp/ifcfg-replace_device
+echo "LLADDR='replace_lladdr'" >> /tmp/ifcfg-replace_device
+echo "UNIQUE=''" >> /tmp/ifcfg-replace_device
+cat /tmp/ifcfg-replace_device > /etc/sysconfig/network/ifcfg-replace_device
+
+# Set layer = 2
+cat /etc/sysconfig/hardware/hwcfg-replace_device | grep -v "QETH_LAYER2_SUPPORT" > /tmp/hwcfg-replace_device
+echo "QETH_LAYER2_SUPPORT='1'" >> /tmp/hwcfg-replace_device
+cat /tmp/hwcfg-replace_device > /etc/sysconfig/hardware/hwcfg-replace_device
+
+# Get node hostname
+HOSTNAME=$(hostname -s)
+
+# These variables are set by nodeset
+export MASTER_IPS=( replace_master )
+
+for i in $(seq 1 20)
+do
+ GOTIT=0
- # Set MAC address
- cat /etc/sysconfig/network/ifcfg-replace_device | grep -v "LLADDR" | grep -v "UNIQUE" > /tmp/ifcfg-replace_device
- echo "LLADDR='replace_lladdr'" >> /tmp/ifcfg-replace_device
- echo "UNIQUE=''" >> /tmp/ifcfg-replace_device
- cat /tmp/ifcfg-replace_device > /etc/sysconfig/network/ifcfg-replace_device
-
- # Set layer = 2
- cat /etc/sysconfig/hardware/hwcfg-replace_device | grep -v "QETH_LAYER2_SUPPORT" > /tmp/hwcfg-replace_device
- echo "QETH_LAYER2_SUPPORT='1'" >> /tmp/hwcfg-replace_device
- cat /tmp/hwcfg-replace_device > /etc/sysconfig/hardware/hwcfg-replace_device
- ]]>
+ # 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
+ fi
+
+ # Get xcat server
+ XCATSERVER=$i:3001
+ export XCATSERVER
+ USEOPENSSLFORXCAT=1
+ export USEOPENSSLFORXCAT
+
+ # Move postscritps into /xcatpost
+ mv $i/postscripts /xcatpost
+ # Remove postscritps
+ rm -rf $i
+ # Make postscripts executable
+ chmod +x /xcatpost/*
+
+ # 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
+ RETRY=0
+ while [ -z "$MYCONT" ]; do
+ RETRY=$(($RETRY+1))
+ if [ $RETRY -eq $MAX_RETRIES ]; then
+ break
+ fi
+
+ # 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
+ break
+ fi
+ done
+
+ # If postscripts for this node are found
+ if [ "$GOTIT" = "1" ]; then
+ # Save the master/service node to /opt/xcat/xcatinfo file
+ if [ ! -f /opt/xcat/xcatinfo ]; then
+ mkdir -p /opt/xcat
+ touch /opt/xcat/xcatinfo
+ fi
+
+ echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
+ break
+ fi
+
+ # Sleep for a couple of seconds
+ RAND=$(perl -e 'print int(rand(5)). "\n"')
+ sleep $RAND
+done
+
+PATH=/xcatpost:$PATH
+export PATH
+
+# Save post boot scripts to /tmp/mypostscript.post
+TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
+echo "$TMP" > /tmp/mypostscript.post
+chmod 755 /tmp/mypostscript.post
+
+# Create post init
+cat >/etc/init.d/xcatpostinit1 << 'EOF'
+# Install directory variable is 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
+mkdir -p /opt/xcat
+cat >/opt/xcat/xcatinstallpost << 'EOF'
+# Install directory variable is 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
+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
+updateflag.awk replace_master 3002
+cd /
+]]>
\ No newline at end of file
diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x
index ed5dfed12..fd5263f87 100644
--- a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x
+++ b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x
@@ -3,16 +3,136 @@
post.sh
shell
- /tmp/ifcfg-replace_device
+echo "LLADDR='replace_lladdr'" >> /tmp/ifcfg-replace_device
+echo "UNIQUE=''" >> /tmp/ifcfg-replace_device
+echo "NAME='OSA Express Network card (replace_nic_addr)'" >> /tmp/ifcfg-replace_device
+cat /tmp/ifcfg-replace_device > /etc/sysconfig/network/ifcfg-replace_device
+
+# Get node hostname
+HOSTNAME=$(hostname -s)
+
+# These variables are set by nodeset
+export MASTER_IPS=( replace_master )
+
+for i in $(seq 1 20)
+do
+ GOTIT=0
- # Set MAC address
- cat /etc/sysconfig/network/ifcfg-replace_device | grep -v "LLADDR" | grep -v "UNIQUE" > /tmp/ifcfg-replace_device
- echo "LLADDR='replace_lladdr'" >> /tmp/ifcfg-replace_device
- echo "UNIQUE=''" >> /tmp/ifcfg-replace_device
- echo "NAME='OSA Express Network card (replace_nic_addr)'" >> /tmp/ifcfg-replace_device
- cat /tmp/ifcfg-replace_device > /etc/sysconfig/network/ifcfg-replace_device
- ]]>
+ # 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
+ fi
+
+ # Get xcat server
+ XCATSERVER=$i:3001
+ export XCATSERVER
+ USEOPENSSLFORXCAT=1
+ export USEOPENSSLFORXCAT
+
+ # Move postscritps into /xcatpost
+ mv $i/postscripts /xcatpost
+ # Remove postscritps
+ rm -rf $i
+ # Make postscripts executable
+ chmod +x /xcatpost/*
+
+ # 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
+ RETRY=0
+ while [ -z "$MYCONT" ]; do
+ RETRY=$(($RETRY+1))
+ if [ $RETRY -eq $MAX_RETRIES ]; then
+ break
+ fi
+
+ # 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
+ break
+ fi
+ done
+
+ # If postscripts for this node are found
+ if [ "$GOTIT" = "1" ]; then
+ # Save the master/service node to /opt/xcat/xcatinfo file
+ if [ ! -f /opt/xcat/xcatinfo ]; then
+ mkdir -p /opt/xcat
+ touch /opt/xcat/xcatinfo
+ fi
+
+ echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
+ break
+ fi
+
+ # Sleep for a couple of seconds
+ RAND=$(perl -e 'print int(rand(5)). "\n"')
+ sleep $RAND
+done
+
+PATH=/xcatpost:$PATH
+export PATH
+
+# Save post boot scripts to /tmp/mypostscript.post
+TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript`
+echo "$TMP" > /tmp/mypostscript.post
+chmod 755 /tmp/mypostscript.post
+
+# Create post init
+cat >/etc/init.d/xcatpostinit1 << 'EOF'
+# Install directory variable is 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
+mkdir -p /opt/xcat
+cat >/opt/xcat/xcatinstallpost << 'EOF'
+# Install directory variable is 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
+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
+updateflag.awk replace_master 3002
+cd /
+]]>
\ No newline at end of file