From e0902c9f69e33cdf8c1b9dd7ec821611eed7c99d Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 6 Aug 2010 14:22:28 +0000 Subject: [PATCH] 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 --- xCAT-server/lib/perl/xCAT/Template.pm | 16 +++++++++- xCAT-server/lib/xcat/plugins/anaconda.pm | 18 +++-------- xCAT-server/lib/xcat/plugins/sles.pm | 31 +++---------------- xCAT-server/lib/xcat/plugins/windows.pm | 3 +- .../install/sles/compute.sles10.ppc64.tmpl | 4 +-- .../install/sles/compute.sles10.s390x.tmpl | 4 +-- .../install/sles/compute.sles11.s390x.tmpl | 4 +-- .../xcat/install/sles/compute.sles11.tmpl | 4 +-- .../share/xcat/install/sles/compute.tmpl | 4 +-- .../share/xcat/install/sles/iscsi.tmpl | 4 +-- .../xcat/install/sles/iscsiibft.sles11.tmpl | 4 +-- .../xcat/install/sles/service.sles11.tmpl | 4 +-- xCAT-server/share/xcat/install/sles/xen.tmpl | 4 +-- .../share/xcat/install/suse/compute.tmpl | 4 +-- 14 files changed, 45 insertions(+), 63 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 2c986b284..7613131fc 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -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; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 07b44dabb..d4f48af1c 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -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) { diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index baed6d3c9..1cf4eb515 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -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) { diff --git a/xCAT-server/lib/xcat/plugins/windows.pm b/xCAT-server/lib/xcat/plugins/windows.pm index bccc76adb..7be25bde2 100644 --- a/xCAT-server/lib/xcat/plugins/windows.pm +++ b/xCAT-server/lib/xcat/plugins/windows.pm @@ -324,7 +324,8 @@ sub mkinstall xCAT::Template->subvars( $tmplfile, "/install/autoinst/$node", - $node + $node, + 0 ); } diff --git a/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.tmpl b/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.tmpl index 942a0dea7..6543b0e6e 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.sles10.ppc64.tmpl @@ -38,10 +38,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.tmpl b/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.tmpl index ff6aff8f2..67d44c16a 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.sles10.s390x.tmpl @@ -539,10 +539,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.tmpl b/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.tmpl index 920bb36a2..5f0fdba4c 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.sles11.s390x.tmpl @@ -539,10 +539,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/sles/compute.sles11.tmpl b/xCAT-server/share/xcat/install/sles/compute.sles11.tmpl index 61fe8d406..ec0b2d54e 100644 --- a/xCAT-server/share/xcat/install/sles/compute.sles11.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.sles11.tmpl @@ -38,10 +38,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/sles/compute.tmpl b/xCAT-server/share/xcat/install/sles/compute.tmpl index 7b69efa8f..acd9f6793 100644 --- a/xCAT-server/share/xcat/install/sles/compute.tmpl +++ b/xCAT-server/share/xcat/install/sles/compute.tmpl @@ -38,10 +38,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/sles/iscsi.tmpl b/xCAT-server/share/xcat/install/sles/iscsi.tmpl index a7adfab77..4def9245f 100644 --- a/xCAT-server/share/xcat/install/sles/iscsi.tmpl +++ b/xCAT-server/share/xcat/install/sles/iscsi.tmpl @@ -50,10 +50,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.tmpl b/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.tmpl index a16b3813d..a72428678 100644 --- a/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.tmpl +++ b/xCAT-server/share/xcat/install/sles/iscsiibft.sles11.tmpl @@ -49,10 +49,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/sles/service.sles11.tmpl b/xCAT-server/share/xcat/install/sles/service.sles11.tmpl index 61fe8d406..ec0b2d54e 100644 --- a/xCAT-server/share/xcat/install/sles/service.sles11.tmpl +++ b/xCAT-server/share/xcat/install/sles/service.sles11.tmpl @@ -38,10 +38,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/sles/xen.tmpl b/xCAT-server/share/xcat/install/sles/xen.tmpl index 44588d051..3e7c89497 100644 --- a/xCAT-server/share/xcat/install/sles/xen.tmpl +++ b/xCAT-server/share/xcat/install/sles/xen.tmpl @@ -82,10 +82,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S# diff --git a/xCAT-server/share/xcat/install/suse/compute.tmpl b/xCAT-server/share/xcat/install/suse/compute.tmpl index 61fe8d406..ec0b2d54e 100644 --- a/xCAT-server/share/xcat/install/suse/compute.tmpl +++ b/xCAT-server/share/xcat/install/suse/compute.tmpl @@ -38,10 +38,10 @@ - #INCLUDE_DEFAULT_PTRNLIST# + #INCLUDE_DEFAULT_PTRNLIST_S# - #INCLUDE_DEFAULT_PKGLIST# + #INCLUDE_DEFAULT_PKGLIST_S#