add the ./sbin/makeclouddata command in xCAT-OpenStack package

This commit is contained in:
jjhua 2013-10-23 22:29:58 -04:00
parent 3e71121c3f
commit 66ea7851a6
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,56 @@
#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
# Used as a standard client cmd that can be used for xcat cmds that do not have
# noderange as an argument. See xcatclient for additional documentation.
# To put the cloud command only in xCAT-OpenStack, just copy the ../bin/xcatclientnnr
# as makeclouddata command here. we couldn't sym link the command makecloudata
# to this script ../bin/xcatclientnnr in xCAT-OpenStack.spec.
BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; }
use lib "$::XCATROOT/lib/perl";
use Cwd;
use File::Basename;
use xCAT::Client;
use strict;
my $bname = basename($0);
my $cmdref;
if ($bname =~ /xcatclientnnr/) { $cmdref->{command}->[0]=shift @ARGV; } # xcatclientnnr was invoked directly and the 1st arg is cmd name that is used to locate the plugin
else { $cmdref->{command}->[0] = $bname; } # the cmd was sym linked to xcatclientnnr
$cmdref->{cwd}->[0] = cwd();
my $data;
# allows our plugins to get the stdin of the cmd that invoked the plugin
if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM'}) )
{
my $rout;
my $rin="";
vec($rin,fileno(STDIN),1)=1;
my $nfound=select($rout=$rin,"","",1);
if ($nfound)
{
while ( <STDIN> ) { $data.=$_; }
$cmdref->{stdin}->[0]=$data;
}
}
else
{
if (-p STDIN) {
while ( <STDIN> ) { $data.=$_; }
$cmdref->{stdin}->[0]=$data;
}
}
push (@{$cmdref->{arg}}, @ARGV);
foreach (keys %ENV) {
if (/^XCAT_/) {
$cmdref->{environment}->{$_} = $ENV{$_};
}
}
xCAT::Client::submit_request($cmdref,\&xCAT::Client::handle_response);
exit $xCAT::Client::EXITCODE;

View File

@ -32,6 +32,7 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT
mkdir -p $RPM_BUILD_ROOT/install/postscripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/templates
mkdir -p $RPM_BUILD_ROOT/%{prefix}/sbin
cp -a lib/perl/xCAT_schema/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema
find $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema -type d -exec chmod 755 {} \;
@ -43,6 +44,9 @@ chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/*
cp -a lib/perl/xCAT/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/*
cp sbin/* $RPM_BUILD_ROOT/%{prefix}/sbin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/sbin/*
#ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/makeclouddata