mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-31 01:56:39 +00:00
add support for multiple pkglist for ubuntu
This commit is contained in:
parent
d3807e08e6
commit
bbf7c42e70
@ -134,51 +134,57 @@ sub subvars {
|
||||
}
|
||||
|
||||
if (("ubuntu" eq $platform) || ("debian" eq $platform)) {
|
||||
# since debian/ubuntu uses a preseed file instead of a kickstart file, pkglist
|
||||
# must be included via simple string replacement instead of using includefile()
|
||||
# since debian/ubuntu uses a preseed file instead of a kickstart file, pkglist
|
||||
# must be included via simple string replacement instead of using includefile()
|
||||
|
||||
# the first line of $pkglistfile is the space-delimited package list
|
||||
# the additional lines are considered preseed directives and included as is
|
||||
# the first line of $pkglistfile is the space-delimited package list
|
||||
# the additional lines are considered preseed directives and included as is
|
||||
|
||||
if ($pkglistfile) {
|
||||
# handle empty and non-empty $pkglistfile's
|
||||
if ($pkglistfile) {
|
||||
# handle empty and non-empty $pkglistfile's
|
||||
my $allpkglist;
|
||||
foreach my $mypkglistfile (split(/,/, $pkglistfile)) {
|
||||
my @tmp_array=();
|
||||
if (open PKGLISTFILE, "<$mypkglistfile") {
|
||||
my $pkglist = '';
|
||||
# append preseed directive lines
|
||||
while (<PKGLISTFILE>) {
|
||||
chomp $_;
|
||||
s/\s+$//; #remove trailing white spaces
|
||||
next if /^\s*$/; #-- skip empty lines
|
||||
next
|
||||
if ( /^\s*#/
|
||||
&& !/^\s*#INCLUDE:[^#^\n]+#/
|
||||
&& !/^\s*#NEW_INSTALL_LIST#/
|
||||
&& !/^\s*#ENV:[^#^\n]+#/); #-- skip comments
|
||||
push(@tmp_array,$_);
|
||||
}
|
||||
|
||||
my @tmp_array=();
|
||||
if ( @tmp_array > 0) {
|
||||
$pkglist=join(' ',@tmp_array);
|
||||
#handle the #INLCUDE# tag recursively
|
||||
my $idir = dirname($mypkglistfile);
|
||||
my $doneincludes=0;
|
||||
while (not $doneincludes) {
|
||||
$doneincludes=1;
|
||||
if ($pkglist =~ /#INCLUDE:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$pkglist =~ s/#INCLUDE:([^#^\n]+)#/debian_includefile($1,$idir)/eg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (open PKGLISTFILE, "<$pkglistfile") {
|
||||
my $pkglist = '';
|
||||
# append preseed directive lines
|
||||
while (<PKGLISTFILE>) {
|
||||
chomp $_;
|
||||
s/\s+$//; #remove trailing white spaces
|
||||
next if /^\s*$/; #-- skip empty lines
|
||||
next
|
||||
if ( /^\s*#/
|
||||
&& !/^\s*#INCLUDE:[^#^\n]+#/
|
||||
&& !/^\s*#NEW_INSTALL_LIST#/
|
||||
&& !/^\s*#ENV:[^#^\n]+#/); #-- skip comments
|
||||
push(@tmp_array,$_);
|
||||
}
|
||||
if ( @tmp_array > 0) {
|
||||
$pkglist=join(' ',@tmp_array);
|
||||
#handle the #INLCUDE# tag recursively
|
||||
my $idir = dirname($pkglistfile);
|
||||
my $doneincludes=0;
|
||||
while (not $doneincludes) {
|
||||
$doneincludes=1;
|
||||
if ($pkglist =~ /#INCLUDE:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$pkglist =~ s/#INCLUDE:([^#^\n]+)#/debian_includefile($1,$idir)/eg;
|
||||
}
|
||||
}
|
||||
}
|
||||
$inc =~ s/#INCLUDE_DEFAULT_PKGLIST_PRESEED#/$pkglist/g;
|
||||
close PKGLISTFILE;
|
||||
$allpkglist.=" $pkglist ";
|
||||
close PKGLISTFILE;
|
||||
}
|
||||
}
|
||||
|
||||
$inc =~ s/#INCLUDE_DEFAULT_PKGLIST_PRESEED#/$allpkglist/g;
|
||||
|
||||
} else {
|
||||
# handle no $pkglistfile
|
||||
$inc =~ s/#INCLUDE_DEFAULT_PKGLIST_PRESEED#//g;
|
||||
}
|
||||
} else {
|
||||
# handle no $pkglistfile
|
||||
$inc =~ s/#INCLUDE_DEFAULT_PKGLIST_PRESEED#//g;
|
||||
}
|
||||
}
|
||||
|
||||
#if user specify the partion file, replace the default partition strategy
|
||||
|
Loading…
x
Reference in New Issue
Block a user