From ee440bfae6c0fb554a817871b1f32bfedf0aeb75 Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 9 Nov 2010 16:16:19 +0000 Subject: [PATCH] more bug fix for updatenode usage git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8104 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/updatenode | 46 ++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/xCAT-client/bin/updatenode b/xCAT-client/bin/updatenode index 831e7b7db..900a6b102 100755 --- a/xCAT-client/bin/updatenode +++ b/xCAT-client/bin/updatenode @@ -35,30 +35,31 @@ Getopt::Long::Configure("bundling"); # 'v|version' => \$::VERSION); # display the usage if -h or --help is specified - -my $arg=shift(@ARGV); - -# Set the noderange -if ($arg !~ /^-/) { - my @tempnr = (); - foreach my $nr (split(/,/, $arg)) { - if ($nr =~ /^\^(.*)$/) { - my $nrf = $1; - if ($nrf !~ /^\//) { #relative path - $nrf = Cwd::abs_path($nrf); - } - $nrf = "\^" . $nrf; - push @tempnr, $nrf; - } else { - push @tempnr, $nr; +my $tmp=join(' ', @ARGV); +if (!($tmp =~ /--help|-h|-v|--version/)) { + my $arg=shift(@ARGV); + # Set the noderange + if ($arg !~ /^-/) { + my @tempnr = (); + foreach my $nr (split(/,/, $arg)) { + if ($nr =~ /^\^(.*)$/) { + my $nrf = $1; + if ($nrf !~ /^\//) { #relative path + $nrf = Cwd::abs_path($nrf); + } + $nrf = "\^" . $nrf; + push @tempnr, $nrf; + } else { + push @tempnr, $nr; + } } + $arg = join(',',@tempnr); + $cmdref->{noderange}->[0]=$arg; + } else { + print "The noderange should be the first argument.\n"; + &updatenode_usage(); + exit 1; } - $arg = join(',',@tempnr); - $cmdref->{noderange}->[0]=$arg; -} else { - print "The noderange should be the first argument.\n"; - &updatenode_usage(); - exit 1; } push (@{$cmdref->{arg}}, @ARGV); @@ -101,6 +102,7 @@ if ($::VERSION) exit 0; } + my $current_userid = getpwuid($>); $ENV{DSH_FROM_USERID} = $current_userid; my $to_userid;