#!/usr/bin/perl # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos72X src/bos/usr/sbin/install/suma/bin/suma_fixinv.perl 1.4.1.1 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2004,2021 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG use strict; use Getopt::Std; # SUMA modules BEGIN { use lib qw(/usr/suma/lib); # Make sure SUMA is there eval { require SUMA::GConfig; }; if($@) { print STDERR "This program requires bos.suma to be installed.\n"; exit 1; } # Now we're okay. SUMA::GConfig->import(qw/:lvl setGlobal getGlobal/); } BEGIN { use SUMA::FixInventory; use SUMA::Messenger qw( MSG_USAGE_SUMA_FIXINV1 ); } # Error Codes my $ecFailure=1; # General error including _usage my $ecPartialFailure=2; # Some clients returned information others did not # Default Values my $numClients=0; # The number of clients including localhost my $hostname="localhost"; setGlobal(LOGFILE_VERBOSE => LVL_OFF); setGlobal(NOTIFY_VERBOSE => LVL_OFF); setGlobal(SCREEN_VERBOSE => LVL_INFO); $ENV{"PATH"}="/usr/bin:/usr/sbin:".$ENV{"PATH"}; sub _usage { mesg(LVL_ERROR, MSG_USAGE_SUMA_FIXINV1); exit($ecFailure); } ################ main ################## # Parse Commandline my %opts; my $numClientsAndSwitches=$#ARGV + 1; my $currentArgNum=0; my $moreSwitches=1; my $instfix_flags; my $format="instfix"; # parse switches getopts('?f:a:',\%opts); if (defined($opts{"?"})) {_usage;} if (defined($opts{"f"})) { if ($opts{"f"} eq "instfix") {$format="instfix";} elsif ($opts{"f"} eq "xml") {$format="xml";} else {_usage;} } if (defined($opts{"a"})) { if ((defined($opts{"f"})) && ($opts{"f"} eq "xml")) {_usage;} $instfix_flags=$opts{"a"}; } # Validate arguments $numClients=@ARGV; # if (($format eq "instfix") && ($numClients > 1)) {_usage;} # after clients added if ($numClients > 1) {_usage;} # before clients added if (($numClients == 1) && ($ARGV[0] ne "localhost")) {_usage;}# before clients added my $pid; my $fix_list_fh; if ($numClients == 0) { ($fix_list_fh,$pid)=get_inv_sys($format,$instfix_flags,"localhost"); } else { ($fix_list_fh,$pid)=get_inv_sys($format,$instfix_flags,@ARGV); } print (<$fix_list_fh>); close $fix_list_fh; waitpid($pid,0); my $rc=$? >> 8; exit $rc;