diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 058c07857..f3b39ab80 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -236,16 +236,25 @@ sub updatenode { #print "postscripts=$postscripts, nodestring=$nodestring\n"; if ($nodestring) { - my $output; + my $cmd; if (xCAT::Utils->isLinux()) { - $output=`XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -e /install/postscripts/xcatdsklspost 1 $postscripts 2>&1`; + $cmd="XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -e /install/postscripts/xcatdsklspost 1 $postscripts 2>&1"; } else { - $output=`XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -e /install/postscripts/xcataixpost 1 $postscripts 2>&1`; + $cmd="XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -e /install/postscripts/xcataixpost 1 $postscripts 2>&1"; + } + if (! open (CMD, "$cmd |")) { + my $rsp={}; + $rsp->{data}->[0]= "Cannot run command $cmd"; + $callback->($rsp); + } else { + while () { + my $rsp={}; + $rsp->{data}->[0]= "$_"; + $callback->($rsp); + } + close(CMD); } - my $rsp={}; - $rsp->{data}->[0]= "$output\n"; - $callback->($rsp); } return 0; diff --git a/xCAT/postscripts/xcataixpost b/xCAT/postscripts/xcataixpost index 9d7e8a64e..bccde47e5 100755 --- a/xCAT/postscripts/xcataixpost +++ b/xCAT/postscripts/xcataixpost @@ -64,8 +64,16 @@ open(XCATINFO,">",$xcatinfo); print XCATINFO "XCATSERVER=$servnode\n"; close(XCATINFO); + # get the contents of the /install/postscripts dir on the server -my $rcpcmd = "rcp -r $servnode:/install/postscripts/* /xcatpost"; +my $rcpcmd; +if ((@ARGV==0) || ($ARGV[0] != 2)) { + $rcpcmd= "rcp -r $servnode:/install/postscripts/* /xcatpost"; +} else { + #when argv[1]=2, there is only one postscript file, user wants only download it to save time + $rcpcmd= "rcp $servnode:/install/postscripts/$ARGV[1] /xcatpost"; +} + if (&runcmd($rcpcmd) != 0) { print "$::sdate xcataixpost: Could not rcp file from $servnode.\n"; print $::LOG_FILE "$::sdate xcataixpost: Could not rcp file from $servnode.\n"; @@ -125,6 +133,9 @@ if (@ARGV<1) { print "$::sdate xcataixpost: Failed to update the xCAT server.\n"; print $::LOG_FILE "$::sdate xcataixpost: Failed to update the xCAT server..\n"; } +} else { + #called by updatenode, infrom user it is done + print "returned"; } diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 26f6b6f40..f3f4b0b19 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -96,6 +96,10 @@ rm -f /tmp/mypostscript killall stunnel rm -rf /etc/stunnel +#tell user it is done when this is called by updatenode command +if [ $# -gt 0 ]; then + echo "returned" +fi