From 016c25940a7b451e6656f20fbf4be40c7ca4088e Mon Sep 17 00:00:00 2001 From: phamt Date: Fri, 1 Mar 2013 21:00:51 +0000 Subject: [PATCH] Fixed nodeset to copy the contents of xcatinstallpost and xcatpostinit1 into the autoyast or kickstart template, allowing postbootscripts to be run. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15352 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/zvm.pm | 22 +++++++++++++++++-- .../xcat/install/scripts/post.rhel5.s390x | 17 +++++--------- .../xcat/install/scripts/post.rhel6.s390x | 15 +++++-------- .../xcat/install/scripts/post.sles10.s390x | 14 +++++------- .../xcat/install/scripts/post.sles11.s390x | 9 ++++---- 5 files changed, 41 insertions(+), 36 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 23ad9c248..fa0bf16c7 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -4833,6 +4833,8 @@ sub nodeSet { my $pkglist; my $patterns = ''; my $packages = ''; + my $postBoot = "$installDir/postscripts/xcatinstallpost"; + my $postInit = "$installDir/postscripts/xcatpostinit1"; if ( $os =~ m/sles/i ) { # Create directory in FTP root (/install) to hold template @@ -4877,9 +4879,17 @@ sub nodeSet { # Add appropriate software packages or patterns $out = `sed --in-place -e "s,replace_software_packages,$packages,g" \ -e "s,replace_software_patterns,$patterns,g" $customTmpl`; - + # Copy postscript into template - $out = `sed --in-place -e "//r $postScript" $customTmpl`; + $out = `sed --in-place -e "//r $postScript" $customTmpl`; + + # Copy the contents of /install/postscripts/xcatpostinit1 + $out = `sed --in-place -e "/replace_xcatpostinit1/r $postInit" $customTmpl`; + $out = `sed --in-place -e "s,replace_xcatpostinit1,,g" $customTmpl`; + + # Copy the contents of /install/postscripts/xcatinstallpost + $out = `sed --in-place -e "/replace_xcatinstallpost/r $postBoot" $customTmpl`; + $out = `sed --in-place -e "s,replace_xcatinstallpost,,g" $customTmpl`; # Edit template my $device; @@ -5107,6 +5117,14 @@ END # Copy postscript into template $out = `sed --in-place -e "/%post/r $postScript" $customTmpl`; + + # Copy the contents of /install/postscripts/xcatpostinit1 + $out = `sed --in-place -e "/replace_xcatpostinit1/r $postInit" $customTmpl`; + $out = `sed --in-place -e "s,replace_xcatpostinit1,,g" $customTmpl`; + + # Copy the contents of /install/postscripts/xcatinstallpost + $out = `sed --in-place -e "/replace_xcatinstallpost/r $postBoot" $customTmpl`; + $out = `sed --in-place -e "s,replace_xcatinstallpost,,g" $customTmpl`; # Edit template my $url = "http://$nfs/$os/s390x/"; diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x index d00cbcac2..8d44ab030 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x @@ -38,7 +38,7 @@ do XCATSERVER=$i:3001 export XCATSERVER - # Move postscritps into /xcatpost + # Move postscripts into /xcatpost mv $i/postscripts /xcatpost # Remove postscritps rm -rf $i @@ -123,8 +123,8 @@ chmod 755 /xcatpost/mypostscript.post # Create post init cat >/etc/init.d/xcatpostinit1 << 'EOF' -# Install directory variable set by nodeset -$INSTALLDIR/postscripts/xcatpostinit1 +# Copy the contents of /install/postscripts/xcatpostinit1 here +replace_xcatpostinit1 EOF # Change permissions chmod 755 /etc/init.d/xcatpostinit1 @@ -132,8 +132,9 @@ chmod 755 /etc/init.d/xcatpostinit1 # Create post install mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' -# Install directory variable set by nodeset -$INSTALLDIR/postscripts/xcatinstallpost +# Copy the contents of /install/postscripts/xcatinstallpost here +replace_xcatinstallpost + if [ -f /xcatpost/mypostscript.post ]; then RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` fi @@ -146,12 +147,6 @@ chmod 755 /opt/xcat/xcatinstallpost chkconfig --add xcatpostinit1 -#create the dskls post -cat >/opt/xcat/xcatdsklspost << 'EOF' -#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# -EOF -chmod 755 /opt/xcat/xcatdsklspost - # Only run preboot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript` echo "$TMP" > /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 f574c92be..f3ca7035e 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x @@ -122,8 +122,8 @@ chmod 755 /xcatpost/mypostscript.post # Create post init cat >/etc/init.d/xcatpostinit1 << 'EOF' -# Install directory variable set by nodeset -$INSTALLDIR/postscripts/xcatpostinit1 +# Copy the contents of /install/postscripts/xcatpostinit1 here +replace_xcatpostinit1 EOF # Change permissions chmod 755 /etc/init.d/xcatpostinit1 @@ -131,8 +131,9 @@ chmod 755 /etc/init.d/xcatpostinit1 # Create post install mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' -# Install directory variable set by nodeset -$INSTALLDIR/postscripts/xcatinstallpost +# Copy the contents of /install/postscripts/xcatinstallpost here +replace_xcatinstallpost + if [ -f /xcatpost/mypostscript.post ]; then RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` fi @@ -145,12 +146,6 @@ chmod 755 /opt/xcat/xcatinstallpost chkconfig xcatpostinit1 on -# Create the dskls post -cat >/opt/xcat/xcatdsklspost << 'EOF' -#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatdsklspost# -EOF -chmod 755 /opt/xcat/xcatdsklspost - # Only run preboot scripts here TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript` echo "$TMP" > /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 45eee796f..319f7f7bb 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x @@ -12,11 +12,6 @@ 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) @@ -137,8 +132,8 @@ chmod 755 /tmp/mypostscript.post # Create post init cat >/etc/init.d/xcatpostinit1 << 'EOF' -# Install directory variable is set by nodeset -$INSTALLDIR/postscripts/xcatpostinit1 +# Copy the contents of /install/postscripts/xcatpostinit1 here +replace_xcatpostinit1 EOF # Change permissions chmod 755 /etc/init.d/xcatpostinit1 @@ -149,8 +144,9 @@ 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 -$INSTALLDIR/postscripts/xcatinstallpost +# Copy the contents of /install/postscripts/xcatinstallpost here +replace_xcatinstallpost + if [ -f /xcatpost/mypostscript.post ]; then RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` fi diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x index e21154d2a..176d17858 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x @@ -133,8 +133,8 @@ chmod 755 /tmp/mypostscript.post # Create post init cat >/etc/init.d/xcatpostinit1 << 'EOF' -# Install directory variable is set by nodeset -$INSTALLDIR/postscripts/xcatpostinit1 +# Copy the contents of /install/postscripts/xcatpostinit1 here +replace_xcatpostinit1 EOF # Change permissions chmod 755 /etc/init.d/xcatpostinit1 @@ -145,8 +145,9 @@ 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 -$INSTALLDIR/postscripts/xcatinstallpost +# Copy the contents of /install/postscripts/xcatinstallpost here +replace_xcatinstallpost + if [ -f /xcatpost/mypostscript.post ]; then RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` fi