Added support for INCLUDE tag for otherpkgs in Postage.pm. Need to handle INCLUDE and subdir for other packagers in genimage later

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3686 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2009-07-02 18:24:32 +00:00
parent 0cca65fd0a
commit 905951f7b4

View File

@ -6,6 +6,7 @@ use xCAT::NodeRange;
use xCAT::Utils;
use xCAT::SvrUtils;
use Data::Dumper;
use File::Basename;
use strict;
BEGIN
{
@ -280,8 +281,21 @@ sub makescript {
}
close(FILE1);
}
if ( @otherpkgs > 0) {
push @scriptd, "OTHERPKGS=". join(',',@otherpkgs) . " \n";
if ( @otherpkgs > 0) {
my $pkgtext=join(',',@otherpkgs);
#handle the #INLCUDE# tag recursively
my $idir = dirname($pkglist);
my $doneincludes=0;
while (not $doneincludes) {
$doneincludes=1;
if ($pkgtext =~ /#INCLUDE:[^#]+#/) {
$doneincludes=0;
$pkgtext =~ s/#INCLUDE:([^#]+)#/includefile($1,$idir)/eg;
}
}
push @scriptd, "OTHERPKGS=$pkgtext\n";
push @scriptd, "export OTHERPKGS\n";
if (-r "/install/post/otherpkgs/$os/$arch/repodata/repomd.xml") {
@ -328,6 +342,37 @@ sub makescript {
return @scriptd;
}
#----------------------------------------------------------------------------
=head3 includefile
handles #INCLUDE# in otherpkg.pkglist file
=cut
#-----------------------------------------------------------------------------
sub includefile
{
my $file = shift;
my $idir = shift;
my @text = ();
unless ($file =~ /^\//) {
$file = $idir."/".$file;
}
open(INCLUDE,$file) || \
return "#INCLUDEBAD:cannot open $file#";
while(<INCLUDE>) {
chomp($_);
push(@text, $_);
}
close(INCLUDE);
return join(',', @text);
}
#----------------------------------------------------------------------------
=head3 getnodesetstate