From b234aa6f9c7299f48efd3de9159a46e257c4f899 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 6 May 2010 08:47:19 +0000 Subject: [PATCH] defect 2988469: display help or version info when -h or -v is specified git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5983 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/updatenode | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/xCAT-client/bin/updatenode b/xCAT-client/bin/updatenode index e13251fef..d4c2504c0 100755 --- a/xCAT-client/bin/updatenode +++ b/xCAT-client/bin/updatenode @@ -29,6 +29,26 @@ if (-p STDIN) { $cmdref->{stdin}->[0]=$data; } +Getopt::Long::Configure("posix_default"); +Getopt::Long::Configure("no_gnu_compat"); +Getopt::Long::Configure("bundling"); +GetOptions('h|help' => \$::HELP, + 'v|version' => \$::VERSION); +# display the usage if -h or --help is specified +if ($::HELP) +{ + &updatenode_usage($callback); + exit 0; +} + +# display the version statement if -v or --verison is specified +if ($::VERSION) +{ + my $version = xCAT::Utils->Version(); + print "$version\n"; + exit 0; +} + my $arg=shift(@ARGV); # Set the noderange @@ -58,9 +78,6 @@ push (@{$cmdref->{arg}}, @ARGV); # if trying to update security, get the password # to access the target node firstly -Getopt::Long::Configure("posix_default"); -Getopt::Long::Configure("no_gnu_compat"); -Getopt::Long::Configure("bundling"); if ( !GetOptions( 'c|cmdlineonly' => \$::CMDLINE,