Add support for the -m option.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4667 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
nott 2009-11-25 15:55:08 +00:00
parent ba69e92a50
commit 4fa0b6620e

View File

@ -57,7 +57,7 @@ unless ($useSocketSSL) {
# Process the command line...
#
# the -c means redo the copy of scripts from the server
if (!GetOptions('copy|c' => \$::opt_c,))
if (!GetOptions('copy|c' => \$::opt_c, 'm=s' => \$::opt_m))
{ # Gather options
exit 1;
}
@ -68,6 +68,26 @@ chomp $::shorthost;
my $foundxcatinfo=0;
my $servnode;
# create new xcatinfo file if -m value is provided
if ($::opt_m) {
if(-f "/etc/xcatinfo") {
# backup the old file - or remove ???
my $cpcmd = "cp /etc/xcatinfo /etc/xcatinfo.orig 2>/dev/null";
if (&runcmd($cpcmd) != 0) {
print "$::sdate xcataixpost: Could not copy /etc/xcatinfo file.\n";
print $::LOG_FILE "$::sdate xcataixpost: Could not copy /etc/xcatinfo file.\n";
}
}
# put the new server in the file
my $xcatinfo="/etc/xcatinfo";
open(XCATINFO,">",$xcatinfo);
print XCATINFO "XCATSERVER=$::opt_m\n";
close(XCATINFO);
}
if (-f "/etc/xcatinfo") {
# if this file exists assume it has the correct server name
my $cmd = "cat /etc/xcatinfo | grep 'XCATSERVER'";
@ -130,6 +150,8 @@ if ( !(-f "/xcatpost/xcataixpost") || $::opt_c ) {
print $::LOG_FILE "$::sdate xcataixpost: Could not mount /install/postscripts from $servnode.\n";
}
my $cpcmd;
if ((@ARGV==0) || ($ARGV[0] != 2)) {
$cpcmd = "cp -p -R /xcatmnt/* /xcatpost 2>/dev/null";
} else {