#!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/lib/perl"; use strict; use File::Basename; #use Data::Dumper; use Getopt::Long; use xCAT::MsgUtils; use xCAT::Client; use xCAT::SINV; use xCAT::Utils; my $bname = basename($0); #----------------------------------------------------------------------------- =head1 sinv This program is the client interface for sinv, the software inventory routine. sinv command The sinv command is designed to check the configuration of nodes in a cluster. The command takes as input command line flags or a file. One or more templates will be compared against the output of a dsh command run on the nodes. The nodes will then be grouped according to the template they matched and a report returned to the administrator. Whether root is required, depends on the required permission on the command to run. See man page for more information =cut #----------------------------------------------------------------------------- # Main my $cmdref; my $rc = 0; my $arg; my @SaveARGV = @ARGV; $cmdref->{command}->[0] = $bname; # save my command name xCAT::SINV->parse_args; # parse the input, error, help or # version will exit my $arg = shift(@SaveARGV); if ($arg =~ /^-/) # no noderange { xCAT::MsgUtils->message("I", "Node range not specified, see sinv man page or sinv -h for syntax.\n"); exit 1; } else { $cmdref->{noderange}->[0] = $arg; # save noderange @ARGV = @SaveARGV; # noderange removed for parsing } foreach (@SaveARGV) { push(@{$cmdref->{arg}}, $_); } xCAT::Client::submit_request($cmdref, \&xCAT::Client::handle_response); exit $xCAT::Client::EXITCODE;