bug fix for #3040277, moved the substitution of some INCLUDESs to Template.pm

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6994 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2010-08-06 14:22:28 +00:00
parent 8877eacb23
commit e0902c9f69
14 changed files with 45 additions and 63 deletions

View File

@ -27,6 +27,8 @@ sub subvars {
my $inf = shift;
my $outf = shift;
$node = shift;
my $pkglistfile=shift;
my $outh;
my $inh;
$idir = dirname($inf);
@ -64,7 +66,19 @@ sub subvars {
#replace the env with the right value so that correct include files can be found
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
#FIRST, do *all* includes, recursive and all
if ($pkglistfile) {
#substitute the tag #INCLUDE_DEFAULT_PKGLIST# with package file name (for full install of rh, centos,SL, esx fedora)
$inc =~ s/#INCLUDE_DEFAULT_PKGLIST#/#INCLUDE:$pkglistfile#/g;
#substitute the tag #INCLUDE_DEFAULT_PKGLIST_S# with package file name (for full install of sles)
#substitute the tag #INCLUDE_DEFAULT_PERNLIST_S# with package file name (for full install sles
#substitute the tag #INCLUDE_DEFAULT_RMPKGLIST_S# with package file name (for full install sles)
$inc =~ s/#INCLUDE_DEFAULT_PKGLIST_S#/#INCLUDE_PKGLIST:$pkglistfile#/g;
$inc =~ s/#INCLUDE_DEFAULT_PTRNLIST_S#/#INCLUDE_PTRNLIST:$pkglistfile#/g;
$inc =~ s/#INCLUDE_DEFAULT_RMPKGLIST_S#/#INCLUDE_RMPKGLIST:$pkglistfile#/g;
}
#do *all* includes, recursive and all
my $doneincludes=0;
while (not $doneincludes) {
$doneincludes=1;

View File

@ -745,16 +745,6 @@ sub mkinstall
next;
}
#substitute the tag #INCLUDE_DEFAULT_PKGS# with package file name
my $new_tmplfile=$tmplfile;
if ($pkglistfile) {
$pkglistfile =~ s/\//\\\//g;
#print "pkglistfile=$pkglistfile\n";
system("sed -e \"s/#INCLUDE_DEFAULT_PKGLIST#/#INCLUDE:$pkglistfile#/\" $tmplfile > /tmp/xcattemp.tmpl");
if ($? == 0) {
$new_tmplfile="/tmp/xcattemp.tmpl";
}
}
#Call the Template class to do substitution to produce a kickstart file in the autoinst dir
my $tmperr;
@ -763,16 +753,16 @@ sub mkinstall
} else {
$tmperr="Unable to find template in /install/custom/install/$platform or $::XCATROOT/share/xcat/install/$platform (for $profile/$os/$arch combination)";
}
if (-r "$new_tmplfile")
if (-r "$tmplfile")
{
$tmperr =
xCAT::Template->subvars(
$new_tmplfile,
$tmplfile,
"/$installroot/autoinst/" . $node,
$node
$node,
$pkglistfile
);
}
system("rm -f /tmp/xcattemp.tmpl");
if ($tmperr)
{

View File

@ -542,41 +542,18 @@ sub mkinstall
next;
}
#substitute the tag #INCLUDE_DEFAULT_PKGLIST# with package file name
#substitute the tag #INCLUDE_DEFAULT_PERNLIST# with package file name
#substitute the tag #INCLUDE_DEFAULT_RMPKGLIST# with package file name
my $new_tmplfile=$tmplfile;
if ($pkglistfile) {
$pkglistfile =~ s/\//\\\//g;
#print "pkglistfile=$pkglistfile\n";
system("sed -e \"s/#INCLUDE_DEFAULT_PKGLIST#/#INCLUDE_PKGLIST:$pkglistfile#/\" $tmplfile > /tmp/xcattemp1.tmpl");
if ($? == 0) {
$new_tmplfile="/tmp/xcattemp1.tmpl";
}
system("sed -e \"s/#INCLUDE_DEFAULT_PTRNLIST#/#INCLUDE_PTRNLIST:$pkglistfile#/\" $new_tmplfile > /tmp/xcattemp2.tmpl");
if ($? == 0) {
$new_tmplfile="/tmp/xcattemp2.tmpl";
}
system("sed -e \"s/#INCLUDE_DEFAULT_RMPKGLIST#/#INCLUDE_RMPKGLIST:$pkglistfile#/\" $new_tmplfile > /tmp/xcattemp3.tmpl");
if ($? == 0) {
$new_tmplfile="/tmp/xcattemp3.tmpl";
}
}
#Call the Template class to do substitution to produce a kickstart file in the autoinst dir
my $tmperr;
if (-r "$new_tmplfile")
if (-r "$tmplfile")
{
$tmperr =
xCAT::Template->subvars(
$new_tmplfile,
$tmplfile,
"$installroot/autoinst/$node",
$node
$node,
$pkglistfile
);
}
system("rm -f /tmp/xcattemp1.tmpl");
system("rm -f /tmp/xcattemp2.tmpl");
system("rm -f /tmp/xcattemp3.tmpl");
if ($tmperr)
{

View File

@ -324,7 +324,8 @@ sub mkinstall
xCAT::Template->subvars(
$tmplfile,
"/install/autoinst/$node",
$node
$node,
0
);
}

View File

@ -38,10 +38,10 @@
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>

View File

@ -539,10 +539,10 @@
<!-- Software to install on Linux -->
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>

View File

@ -539,10 +539,10 @@
<!-- Software to install on Linux -->
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>

View File

@ -38,10 +38,10 @@
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>

View File

@ -38,10 +38,10 @@
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>

View File

@ -50,10 +50,10 @@
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>

View File

@ -49,10 +49,10 @@
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>

View File

@ -38,10 +38,10 @@
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>

View File

@ -82,10 +82,10 @@
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
<configure>

View File

@ -38,10 +38,10 @@
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST#
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST#
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>