From 21cf066bd42d1f912e42b71bca0d88903bd39c3e Mon Sep 17 00:00:00 2001 From: vallard Date: Tue, 23 Nov 2010 18:06:21 +0000 Subject: [PATCH] added image based postscripts git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8243 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Postage.pm | 33 ++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 63923c424..5da8cfbf8 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -124,6 +124,7 @@ sub makescript my $typetab = xCAT::Table->new('nodetype'); my $posttab = xCAT::Table->new('postscripts'); my $sitetab = xCAT::Table->new('site'); + my $ostab = xCAT::Table->new('ostab'); my %rsp; my $rsp; @@ -136,6 +137,12 @@ sub makescript return undef; } + unless ($ostab){ + push @{$rsp->{data}}, + "Unable to open os table (ostab)"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return undef; + } # read all attributes for the site table and write an export # for them in the post install file @@ -551,7 +558,8 @@ sub makescript push @scriptd, "# postscripts-start-here\n"; my %post_hash = (); #used to reduce duplicates - # get the xcatdefaults entry in the postscripts table + + # get the xcatdefaults entry in the postscripts table my $et = $posttab->getAttribs({node => "xcatdefaults"}, 'postscripts', 'postbootscripts'); @@ -568,8 +576,29 @@ sub makescript } } } + + # get postscripts for images + my $osimgname = $provmethod; - # get postscripts + if($osimgname =~ /install|netboot|statelite/){ + $osimgname = "$os-$arch-$provmethod-$profile"; + } + my $et2 = + $ostab->getAttribs({'image' => "$osimgname"}, ['postscripts', 'postbootscripts']); + $ps = $et2->{'postscripts'}; + if ($ps) + { + foreach my $n (split(/,/, $ps)) + { + if (!exists($post_hash{$n})) + { + $post_hash{$n} = 1; + push @scriptd, $n . "\n"; + } + } + } + + # get postscripts for node specific my $et1 = $posttab->getNodeAttribs($node, ['postscripts', 'postbootscripts']); $ps = $et1->{'postscripts'};