From f4a01ffd3667dde705ac91defaffacba54f749d2 Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 15 Dec 2009 15:04:47 +0000 Subject: [PATCH] Postage.pm changes to support postbootscripts git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4781 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Postage.pm | 39 +++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 467ae0f43..ee8488057 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -349,8 +349,8 @@ sub makescript { push @scriptd, "# postscripts-start-here\n"; my %post_hash=(); #used to reduce duplicates - # get the xcatdefaults entry in the postscripts table - my $et = $posttab->getAttribs({node=>"xcatdefaults"},'postscripts'); + # get the xcatdefaults entry in the postscripts table + my $et = $posttab->getAttribs({node=>"xcatdefaults"},'postscripts','postbootscripts'); my $defscripts = $et->{'postscripts'}; if ($defscripts) { foreach my $n (split(/,/, $defscripts)) { @@ -362,8 +362,8 @@ sub makescript { } # get postscripts - my $et = $posttab->getNodeAttribs($node, ['postscripts']); - $ps = $et->{'postscripts'}; + my $et1 = $posttab->getNodeAttribs($node, ['postscripts','postbootscripts']); + $ps = $et1->{'postscripts'}; if ($ps) { foreach my $n (split(/,/, $ps)) { if (! exists($post_hash{$n})) { @@ -377,6 +377,37 @@ sub makescript { ###Please do not remove or modify this line of code!!! xcatdsklspost depends on it push @scriptd, "# postscripts-end-here\n"; + + ###Please do not remove or modify this line of code!!! xcatdsklspost depends on it + push @scriptd, "# postbootscripts-start-here\n"; + + my %postboot_hash=(); #used to reduce duplicates + my $defscripts = $et->{'postbootscripts'}; + if ($defscripts) { + foreach my $n (split(/,/, $defscripts)) { + if (! exists($postboot_hash{$n})) { + $postboot_hash{$n}=1; + push @scriptd, $n."\n"; + } + } + } + + + # get postscripts + my $ps = $et1->{'postbootscripts'}; + if ($ps) { + foreach my $n (split(/,/, $ps)) { + if (! exists($postboot_hash{$n})) { + $postboot_hash{$n}=1; + push @scriptd, $n."\n"; + } + } + } + + + ###Please do not remove or modify this line of code!!! xcatdsklspost depends on it + push @scriptd, "# postbootscripts-end-here\n"; + return @scriptd; }