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/trunk@15355 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -4909,6 +4909,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
 | 
			
		||||
@@ -4953,9 +4955,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 "/<scripts>/r $postScript" $customTmpl`;
 | 
			
		||||
            $out = `sed --in-place -e "/<scripts>/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;
 | 
			
		||||
@@ -5187,6 +5197,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
 | 
			
		||||
            if (!$repo) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user