2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-18 20:30:56 +00:00

run mknb for both ppc64 and x86_64

This commit is contained in:
ertaozh
2016-08-17 02:55:28 -04:00
parent b950a4ccb4
commit 6c43f8f716

View File

@ -1911,7 +1911,8 @@ sub setupLinuxexports
Creates a network boot root image on Linux
Run mknb to put xCAT-genesis-scripts-x86_64 and xCAT-genesis-base-x86_64 together and in /tftpboot
From 2.12.2, both xCAT-genesis-scripts-x86_64 and xCAT-genesis-scripts-ppc64 will be installed.
So, will run mknb twice, one for ppc64 and another for x86_64
=cut
#-----------------------------------------------------------------------------
@ -1920,35 +1921,30 @@ sub mknb
# The xCAT-genesis-scripts.spec file touches /etc/xcat/genesis-scripts-updated or
# the xCAT-genesis-base.spec file touches /etc/xcat/genesis-base-updated,
# so we know to run mknb here.
my $cmd;
if ($::arch =~ /ppc/) {
$::arch = "ppc64";
}
if ((($::arch eq "x86_64") || ($::arch =~ /ppc/)) && (-f '/etc/xcat/genesis-scripts-updated')) {
my $cmd = "$::XCATROOT/sbin/mknb";
my $run_mknb = 0;
if (-f '/etc/xcat/genesis-scripts-updated') {
unlink '/etc/xcat/genesis-scripts-updated';
# Do not print messages or run command twice
if (-f '/etc/xcat/genesis-base-updated') {
unlink '/etc/xcat/genesis-base-updated';
}
$cmd = "$::XCATROOT/sbin/mknb $::arch";
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts-$::arch ...");
$run_mknb = 1;
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts ...");
}
if ((($::arch eq "x86_64") || ($::arch =~ /ppc/)) && (-f '/etc/xcat/genesis-base-updated')) {
if (-f '/etc/xcat/genesis-base-updated') {
unlink '/etc/xcat/genesis-base-updated';
$cmd = "$::XCATROOT/sbin/mknb $::arch";
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-base-$::arch ...");
}
# my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($cmd) {
system($cmd);
if ($? != 0) {
my $rc = $? >> 8;
xCAT::MsgUtils->message('E', "The 'mknb $::arch' command returned error code: $rc.");
unless ($run_mknb) {
$run_mknb = 1;
xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-base ...");
}
else {
xCAT::MsgUtils->message('I', "The 'mknb $::arch' command completed successfully.");
}
if ($run_mknb) {
foreach (qw(ppc64 x86_64)) {
system("$cmd $_");
if ($? != 0) {
my $rc = $? >> 8;
xCAT::MsgUtils->message('E', "The 'mknb $_' command returned error code: $rc.");
}
else {
xCAT::MsgUtils->message('I', "The 'mknb $_' command completed successfully.");
}
}
}
}