8b2fee5c16
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@545 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
67 lines
1.4 KiB
Perl
Executable File
67 lines
1.4 KiB
Perl
Executable File
#!/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 File::Basename;
|
|
use xCAT::MsgUtils;
|
|
use xCAT::Client;
|
|
|
|
my $bname = basename($0);
|
|
|
|
#########################################
|
|
# Main
|
|
#
|
|
# xcatDBcmds
|
|
#
|
|
# Build hash and submit request
|
|
#
|
|
# Handles: mkdef, chdef, lsdef, rmdef, and xcat2nim commands
|
|
#
|
|
# Note: The subroutines that implement these commands
|
|
# are, for the most part, in:
|
|
# /opt/xcat/lib/perl/xCAT_plugin/DBobjectdefs.pm
|
|
# /opt/xcat/lib/perl/xCAT_plugin/xcat2nim.pm
|
|
# /opt/xcat/lib/perl/xCAT/DBobjUtils.pm
|
|
# -on the xCAT management node
|
|
#
|
|
#########################################
|
|
|
|
my $cmdref;
|
|
|
|
# set the command name to pass to the plugin
|
|
if ($bname =~ /xcatDBcmds/)
|
|
{
|
|
$cmdref->{command}->[0] = shift @ARGV;
|
|
}
|
|
elsif ($bname =~ /^(.*$)/)
|
|
{
|
|
$cmdref->{command}->[0] = $1;
|
|
}
|
|
else
|
|
{
|
|
printf("Bad usage\n");
|
|
exit 1;
|
|
}
|
|
|
|
# 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 (@ARGV)
|
|
{
|
|
push(@{$cmdref->{arg}}, $_);
|
|
}
|
|
|
|
xCAT::Client::submit_request($cmdref,\&xCAT::Client::handle_response);
|
|
exit $xCAT::Client::EXITCODE;
|