mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	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:
		| @@ -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; | ||||
|   | ||||
| @@ -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) | ||||
|         { | ||||
|   | ||||
| @@ -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) | ||||
|         { | ||||
|   | ||||
| @@ -324,7 +324,8 @@ sub mkinstall | ||||
|               xCAT::Template->subvars( | ||||
|                          $tmplfile, | ||||
|                          "/install/autoinst/$node", | ||||
|                          $node | ||||
|                          $node, | ||||
|                          0 | ||||
|                          ); | ||||
|         } | ||||
|          | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|    | ||||
|   | ||||
| @@ -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> | ||||
|    | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user