2008-05-19 19:05:54 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
|
|
use Getopt::Long;
|
|
|
|
use File::Basename;
|
|
|
|
sub usage {
|
|
|
|
print basename($0)." usage:\n";
|
|
|
|
print " ".basename($0)." [-o|--osver [-p|--profile] [-a|--arch] [-c|--console] <noderange>\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
my $OSVER;
|
|
|
|
my $PROFILE;
|
|
|
|
my $ARCH;
|
|
|
|
my $CONSOLE;
|
|
|
|
unless (GetOptions(
|
|
|
|
'o|osver=s' => \$OSVER,
|
|
|
|
'p|profile=s' => \$PROFILE,
|
|
|
|
'a|arch=s' => \$ARCH,
|
|
|
|
'c|console' => \$CONSOLE
|
|
|
|
)) {
|
|
|
|
usage;
|
|
|
|
exit 1;
|
|
|
|
}
|
2010-04-26 17:53:32 +00:00
|
|
|
my $arraysize=@ARGV;
|
|
|
|
if ($arraysize > 1) {
|
|
|
|
print "noderange invalid\n";
|
|
|
|
usage;
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
if ($arraysize == 0) {
|
|
|
|
print "noderange not supplied\n";
|
|
|
|
usage;
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
my $noderange=@ARGV[0];
|
|
|
|
|
2008-05-19 19:05:54 +00:00
|
|
|
my $nodechline = "";
|
|
|
|
if ($OSVER) {
|
|
|
|
$nodechline = "nodetype.os=$OSVER";
|
|
|
|
}
|
|
|
|
if ($PROFILE) {
|
|
|
|
$nodechline .= " nodetype.profile=$PROFILE";
|
|
|
|
}
|
|
|
|
if ($ARCH) {
|
|
|
|
$nodechline .= " nodetype.arch=$ARCH";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $rc;
|
|
|
|
if ($nodechline) {
|
|
|
|
$rc=system("nodech $noderange $nodechline");
|
|
|
|
}
|
|
|
|
if ($rc) { die "nodech failure" };
|
|
|
|
$rc=system("nodeset $noderange install");
|
|
|
|
if ($rc) { die "nodeset failure" };
|
|
|
|
$rc=system("rpower $noderange boot");
|
|
|
|
if ($rc) { die "rpower failure" };
|
|
|
|
if (basename($0) =~ /rinstall/) {
|
|
|
|
if ($CONSOLE) {
|
|
|
|
exec("rcons $noderange");
|
|
|
|
}
|
|
|
|
} elsif (basename($0) =~ /winstall/) {
|
|
|
|
exec("wcons $noderange");
|
|
|
|
}
|