From 6c43f8f716ae3b228806588a19d41e58ee1646b5 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 17 Aug 2016 02:55:28 -0400 Subject: [PATCH] run mknb for both ppc64 and x86_64 --- xCAT-server/sbin/xcatconfig | 48 +++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 2686e9b98..e960e1640 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -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."); + } } } }