From f2cec79b7a919aaa62056ec99d05d5a7bd9eefec Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 7 Feb 2012 19:22:25 +0000 Subject: [PATCH] added run_ps for all the postscripts for diskful install git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11505 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/install/scripts/post.debian | 24 ++ .../share/xcat/install/scripts/post.rh | 25 ++ .../share/xcat/install/scripts/post.rh.iscsi | 26 ++ .../xcat/install/scripts/post.rhel5.s390x | 26 ++ .../xcat/install/scripts/post.rhel6.s390x | 26 ++ .../share/xcat/install/scripts/post.sles | 26 ++ .../xcat/install/scripts/post.sles.iscsi | 25 ++ .../xcat/install/scripts/post.sles10.s390x | 308 ++++++++++-------- .../share/xcat/install/scripts/post.sles11 | 26 ++ .../xcat/install/scripts/post.sles11.iscsi | 26 ++ .../xcat/install/scripts/post.sles11.raid1 | 25 ++ .../xcat/install/scripts/post.sles11.s390x | 299 +++++++++-------- .../share/xcat/install/scripts/post.ubuntu | 26 ++ 13 files changed, 610 insertions(+), 278 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.debian b/xCAT-server/share/xcat/install/scripts/post.debian index 2bb38be0d..d322cf3ae 100644 --- a/xCAT-server/share/xcat/install/scripts/post.debian +++ b/xCAT-server/share/xcat/install/scripts/post.debian @@ -97,6 +97,30 @@ cd /xcatpost #/xcatpost/#TABLE:nodelist:THISNODE:node# export PATH=/xcatpost:$PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + #save the postboot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.rh b/xCAT-server/share/xcat/install/scripts/post.rh index ecea8c013..66378bee4 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh +++ b/xCAT-server/share/xcat/install/scripts/post.rh @@ -108,6 +108,31 @@ cd /xcatpost #/xcatpost/#TABLE:nodelist:THISNODE:node# export PATH=/xcatpost:$PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + #save the postboot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.rh.iscsi b/xCAT-server/share/xcat/install/scripts/post.rh.iscsi index 3215ff570..42bac0698 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh.iscsi +++ b/xCAT-server/share/xcat/install/scripts/post.rh.iscsi @@ -105,6 +105,32 @@ cd /xcatpost #/xcatpost/#TABLE:nodelist:THISNODE:node# export PATH=/xcatpost:$PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + + #save the postboot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x index 2d42d1b36..58f7c9a0c 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel5.s390x @@ -85,6 +85,32 @@ done cd /xcatpost export PATH=/xcatpost:$PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + + # Save post boot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x index d739ecb9d..4314c361a 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x @@ -85,6 +85,32 @@ done cd /xcatpost export PATH=/xcatpost:$PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + + # Save post boot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.sles b/xCAT-server/share/xcat/install/scripts/post.sles index 5fdd47236..db3e3c4a9 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles +++ b/xCAT-server/share/xcat/install/scripts/post.sles @@ -138,6 +138,32 @@ echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo PATH=/xcatpost:$PATH export PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + + #save the postboot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.sles.iscsi b/xCAT-server/share/xcat/install/scripts/post.sles.iscsi index 345e57774..7b806f39d 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles.iscsi +++ b/xCAT-server/share/xcat/install/scripts/post.sles.iscsi @@ -88,6 +88,31 @@ done PATH=/xcatpost:$PATH export PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + #save the postboot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x index f87c17be0..dbb615cfa 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles10.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles10.s390x @@ -1,142 +1,168 @@ - - + + \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11 b/xCAT-server/share/xcat/install/scripts/post.sles11 index c7b2bbb94..58c6b16e0 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11 +++ b/xCAT-server/share/xcat/install/scripts/post.sles11 @@ -121,6 +121,32 @@ echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo PATH=/xcatpost:$PATH export PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + + #save the postboot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.iscsi b/xCAT-server/share/xcat/install/scripts/post.sles11.iscsi index 0782a0105..5ef7c4fd3 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11.iscsi +++ b/xCAT-server/share/xcat/install/scripts/post.sles11.iscsi @@ -98,6 +98,32 @@ done PATH=/xcatpost:$PATH export PATH +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + + #save the postboot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.raid1 b/xCAT-server/share/xcat/install/scripts/post.sles11.raid1 index d8ef5ecc6..1fd756173 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11.raid1 +++ b/xCAT-server/share/xcat/install/scripts/post.sles11.raid1 @@ -126,6 +126,31 @@ parted /dev/sdb set 1 boot on dd if=/dev/sda1 of=/dev/sdb1 bootlist -m normal sda sdb +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + #save the postboot scripts to /tmp/mypostscript.post TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /tmp/mypostscript.post diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x index fd5263f87..5cd8ac1cb 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11.s390x +++ b/xCAT-server/share/xcat/install/scripts/post.sles11.s390x @@ -1,138 +1,163 @@ - - + + \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index 6c4249b1c..d50c814e1 100644 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -100,6 +100,32 @@ export PATH=/xcatpost:$PATH # mypostscript.post must survive a reboot. Traditionally, xCAT has put mypostscript.post in /tmp. # However, Ubuntu cleans /tmp on reboot. So, for Ubuntu, /var/tmp is used instead. +# use the run_ps subroutine to run the postscripts +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo " +# subroutine used to run postscripts +run_ps () { + logdir=\"/var/log/xcat\" + mkdir -p \$logdir + logfile=\"/var/log/xcat/xcat.log\" + + if [ -f \$1 ]; then + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 1> /tmp/tmp4xcatlog + cat /tmp/tmp4xcatlog | tee -a \$logfile + else + echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile + fi +} +# subroutine end + +" > /tmp/mypostscript +echo "$TMP" >> /tmp/mypostscript +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript + + + TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` echo "$TMP" > /var/tmp/mypostscript.post chmod 755 /var/tmp/mypostscript.post