From fc6536eb30534e927704e288a0e22514beea21f6 Mon Sep 17 00:00:00 2001 From: ligc Date: Sun, 27 Jul 2014 22:43:38 -0400 Subject: [PATCH] fix for bug 4150: modify xCAT-genesis-scripts.spec, xCAT-genesis-base.spec and xcatconfig to not run mknb twice during xcat installation/update --- xCAT-genesis-builder/xCAT-genesis-base.spec | 5 ++- .../xCAT-genesis-scripts.spec | 1 + xCAT-server/sbin/xcatconfig | 31 +++++++++++++------ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index dff9dc327..c4e537d96 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -53,7 +53,10 @@ cd - if [ "$1" == "2" ]; then #only on upgrade, as on install it's probably not going to work... if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image . /etc/profile.d/xcat.sh - mknb %{tarch} + #mknb %{tarch} + echo "If you are installing/updating xCAT-genesis-base separately, not as part of installing/updating all of xCAT, run 'mknb manually'" + mkdir -p /etc/xcat + touch /etc/xcat/genesis-base-updated fi fi diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index 1b0db1fd3..70ffe87e4 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -67,6 +67,7 @@ cd - # should run mknb. Tried to use rpm triggers, but in several cases the trigger would # get run multiple times. #echo "touching /etc/xcat/genesis-scripts-updated" +echo "If you are installing/updating xCAT-genesis-base separately, not as part of installing/updating all of xCAT, run 'mknb manually'" mkdir -p /etc/xcat touch /etc/xcat/genesis-scripts-updated diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index fde67b8db..4b1e3d2fd 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -31,7 +31,6 @@ use Socket; #----------------------------------------------------------------------------- # Main - $::progname = "xcatconfig"; my $args = join ' ', @ARGV; $::command = "$0 $args"; @@ -1869,22 +1868,34 @@ sub setupLinuxexports #----------------------------------------------------------------------------- sub mknb { - # The xCAT-genesis-scripts.spec file touches /etc/xcat/genesis-scripts-updated so we know to run - # mknb here. - if ($::arch eq "x86_64" && (-f '/etc/xcat/genesis-scripts-updated') ) { - unlink '/etc/xcat/genesis-scripts-updated'; - my $cmd = "$::XCATROOT/sbin/mknb $::arch"; - xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts-x86_64 ..."); + # 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 eq "x86_64" && (-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-x86_64 ..."); + } + + if ($::arch eq "x86_64" && (-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-x86_64 ..."); + } #my $outref = xCAT::Utils->runcmd("$cmd", 0); system($cmd); if ($? != 0) { - my $rc = $? >> 8; - xCAT::MsgUtils->message('E', "The 'mknb $::arch' command returned error code: $rc."); + my $rc = $? >> 8; + xCAT::MsgUtils->message('E', "The 'mknb $::arch' command returned error code: $rc."); } else { xCAT::MsgUtils->message('I', "The 'mknb $::arch' command completed successfully."); } - } } #-----------------------------------------------------------------------------