6035f4b0e5
-Have xCAT-client install the rvid backends git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2534 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
51 lines
1.4 KiB
Perl
Executable File
51 lines
1.4 KiB
Perl
Executable File
#!/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 Cwd;
|
|
#use IO::Socket::SSL;
|
|
#use IO::Socket::INET;
|
|
my %rvidhash;
|
|
my $xcatroot = $ENV{'XCATROOT'};
|
|
unless ($xcatroot) {
|
|
$xcatroot = "/opt/xcat"
|
|
}
|
|
use File::Basename;
|
|
#use Data::Dumper;
|
|
use xCAT::Client;
|
|
use Data::Dumper;
|
|
sub process_response {
|
|
my $resp = shift;
|
|
foreach my $rst (\@{$resp->{node}}) {
|
|
foreach my $rsp (@$rst) {
|
|
$rvidhash{$rsp->{name}->[0]}->{$rsp->{data}->[0]->{desc}->[0]} = $rsp->{data}->[0]->{contents}->[0];
|
|
}
|
|
}
|
|
}
|
|
|
|
my $cmdref;
|
|
$cmdref->{command}->[0] = 'getrvidparms';
|
|
|
|
# Consider the 1st non-hyphen arg to be the noderange. All others (before and after) go on the arg list.
|
|
my $arg=shift(@ARGV);
|
|
while ($arg =~ /^-/) {
|
|
push (@{$cmdref->{arg}}, $arg);
|
|
$arg=shift(@ARGV);
|
|
}
|
|
if ($arg ne "NO_NODE_RANGE") {
|
|
$cmdref->{noderange}->[0]=$arg;
|
|
}
|
|
push (@{$cmdref->{arg}}, @ARGV);
|
|
|
|
xCAT::Client::submit_request($cmdref,\&process_response);
|
|
my %CLEANENV=%ENV;
|
|
foreach my $node (keys %rvidhash) {
|
|
%ENV=%CLEANENV;
|
|
foreach my $var (keys %{$rvidhash{$node}}) {
|
|
$ENV{"rvid_$var"}=$rvidhash{$node}->{$var};
|
|
}
|
|
system("$xcatroot/share/xcat/rvid/rvid.".$ENV{"rvid_method"}." &");
|
|
}
|
|
exit $xCAT::Client::EXITCODE;
|