12718d784c
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9099 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
68 lines
1.4 KiB
Perl
68 lines
1.4 KiB
Perl
#!/usr/bin/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 Cwd;
|
|
use File::Basename;
|
|
use xCAT::MsgUtils;
|
|
use xCAT::Client;
|
|
|
|
use Getopt::Std;
|
|
|
|
my $bname = basename($0);
|
|
#########################################
|
|
# Main
|
|
#
|
|
# lsslp
|
|
#
|
|
# Build hash and submit request
|
|
#
|
|
# Handles: lsslp
|
|
#
|
|
# Note: The subroutines that implement these commands are in:
|
|
# /opt/xcat/lib/perl/xCAT_plugin/lsslp.pm
|
|
#
|
|
#########################################
|
|
my $cmdref;
|
|
# set the command name to pass to the plugin
|
|
if ($bname =~ /lsslp/)
|
|
{
|
|
$cmdref->{command}->[0] = $bname;
|
|
}
|
|
else
|
|
{
|
|
printf("Bad usage\n");
|
|
exit 1;
|
|
}
|
|
|
|
|
|
$cmdref->{cwd}->[0] = cwd();
|
|
# get info from files piped in as stdin
|
|
if (-p STDIN) {
|
|
my $data;
|
|
while ( <STDIN> ) { $data.=$_; }
|
|
$cmdref->{stdin}->[0]=$data;
|
|
}
|
|
|
|
# add all the cmd line args to the hash - to pass to the plugin subroutine
|
|
foreach my $a (@ARGV)
|
|
{
|
|
if ($a =~ /^\w+\-\w+$/)
|
|
{
|
|
push @{$cmdref->{noderange}}, $a;
|
|
} else
|
|
{
|
|
push @{$cmdref->{arg}}, $a;
|
|
}
|
|
}
|
|
|
|
foreach (keys %ENV) {
|
|
if (/^XCAT_/) {
|
|
$cmdref->{environment}->{$_} = $ENV{$_};
|
|
}
|
|
}
|
|
|
|
xCAT::Client::submit_request($cmdref,\&xCAT::Client::handle_response);
|
|
exit $xCAT::Client::EXITCODE;
|