diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index c6240a710..f9242a50b 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -359,11 +359,12 @@ sub preprocess_updatenode foreach (@posts) { - if (!-e "$installdir/postscripts/$_") + my @aa=split(' ', $_); + if (!-e "$installdir/postscripts/$aa[0]") { my $rsp = {}; $rsp->{data}->[0] = - "The postcript $installdir/postscripts/$_ does not exist."; + "The postcript $installdir/postscripts/$aa[0] does not exist."; $callback->($rsp); return \@requests; } diff --git a/xCAT/postscripts/setupscratch b/xCAT/postscripts/setupscratch index 288523951..a85575323 100755 --- a/xCAT/postscripts/setupscratch +++ b/xCAT/postscripts/setupscratch @@ -3,39 +3,45 @@ # # This postscript sets up a scratch area on the local disk for stateless # nodes. It is for Linux only. +# If run with -f flag, it will wipe out all the contents on the disk and +# repartition the disk before setting up the scratch area. # #==================================================================== ME="setupscratch" -if grep sda1 /proc/partitions >/dev/null 2>&1 -then - echo Autodetected existing /dev/sda1 - logger -t $ME Autodetected existing /dev/sda1 - echo Checking filesystem /dev/sda1 - logger -t $ME Checking filesystem /dev/sda1 - fsck -y /dev/sda1 - mkdir -p /scratch - echo mounting existing /dev/sda1 to /scratch - logger -t $ME mounting existing /dev/sda1 to /scratch - if mount /dev/sda1 /scratch - then - echo - echo Done! - echo - exit 0 - else - echo mounting /dev/sda1 to /scratch failed - logger -t $ME mounting /dev/sda1 to /scratch failed - fi -fi +mydir="/scratch" +umount $mydir +if [[ $1 != "-f" ]] +then + if grep sda1 /proc/partitions >/dev/null 2>&1 + then + echo Autodetected existing /dev/sda1 + logger -t $ME Autodetected existing /dev/sda1 + echo Checking filesystem /dev/sda1 + logger -t $ME Checking filesystem /dev/sda1 + fsck -y /dev/sda1 + mkdir -p $mydir + echo mounting existing /dev/sda1 to $mydir + logger -t $ME mounting existing /dev/sda1 to $mydir + if mount /dev/sda1 $mydir + then + echo + echo Done! + echo + exit 0 + else + echo mounting /dev/sda1 to $mydir failed + logger -t $ME mounting /dev/sda1 to $mydir failed + fi + fi +fi echo Creating Partition logger -t $ME Creating Partition -parted /dev/sda mklabel gpt -MB=$(cat /proc/partitions | grep sda | awk '{printf "%d\n",( $3 / (1024 )) }') -parted /dev/sda mkpart primary ext2 0 $MB +parted -s /dev/sda mklabel gpt +parted -s -- /dev/sda mkpart primary ext3 0 -0 if grep sda1 /proc/partitions >/dev/null 2>&1 then sleep 5 @@ -51,10 +57,10 @@ fi echo Creating new ext3 filesystem: /dev/sda1 logger -t $ME Creating new ext3 filesystem: /dev/sda1 mke2fs -j /dev/sda1 -mkdir -p /scratch -echo mounting new /dev/sda1 to /scratch -logger -t $ME mounting new /dev/sda1 to /scratch -mount /dev/sda1 /scratch +mkdir -p $mydir +echo mounting new /dev/sda1 to $mydir +logger -t $ME mounting new /dev/sda1 to $mydir +mount /dev/sda1 $mydir echo echo Done! echo diff --git a/xCAT/postscripts/xcataixpost b/xCAT/postscripts/xcataixpost index 9d630c476..be6f2294f 100755 --- a/xCAT/postscripts/xcataixpost +++ b/xCAT/postscripts/xcataixpost @@ -277,8 +277,8 @@ run_ps () { logfile=\\"/var/log/xcat/xcat.log\\" if [[ -f \\\$1 ]]; then - echo \\"Running postscript: \\\$1\\" | tee -a \\\$logfile - ./\\\$1 2>&1 | tee -a \\\$logfile + echo \\"Running postscript: \\\$@\\" | tee -a \\\$logfile + ./\\\$@ 2>&1 | tee -a \\\$logfile else echo \\"Postscript \\\$1 does NOT exist.\\" | tee -a \\\$logfile fi diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 1f6d521e3..75cac571d 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -296,8 +296,8 @@ run_ps () { logfile=\"/var/log/xcat/xcat.log\" if [[ -f \$1 ]]; then - echo \"Running postscript: \$1\" | tee -a \$logfile - ./\$1 2>&1 | tee -a \$logfile + echo \"Running postscript: \$@\" | tee -a \$logfile + ./\$@ 2>&1 | tee -a \$logfile else echo \"Postscript \$1 does NOT exist.\" | tee -a \$logfile fi