changes for first using /install/custom/.. directories for seaching the package list and template files for mkinstall and packimage
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2158 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -1,5 +1,10 @@ | ||||
| # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
| package xCAT_plugin::anaconda; | ||||
| BEGIN | ||||
| { | ||||
|   $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; | ||||
| } | ||||
| use lib "$::XCATROOT/lib/perl"; | ||||
| use Storable qw(dclone); | ||||
| use Sys::Syslog; | ||||
| use Thread qw(yield); | ||||
| @@ -424,26 +429,18 @@ sub mkinstall | ||||
|         $genos =~ s/\..*//; | ||||
|         if ($genos =~ /rh.s(\d*)/) | ||||
|         { | ||||
|             unless (-r $::XCATROOT | ||||
|                     . "/share/xcat/install/$platform/$profile.$genos.$arch.tmpl" | ||||
|                     or -r $::XCATROOT | ||||
|                     . "/share/xcat/install/$platform/$profile.$genos.tmpl") | ||||
|             unless (-r "$installroot/custom/install/$platform/$profile.$genos.$arch.tmpl" | ||||
|                  or -r "/install/custom/install/$platform/$profile.$genos.tmpl" | ||||
|                  or -r "$::XCATROOT/share/xcat/install/$platform/$profile.$genos.$arch.tmpl" | ||||
|                  or -r "$::XCATROOT/share/xcat/install/$platform/$profile.$genos.tmpl") | ||||
|             { | ||||
|                 $genos = "rhel$1"; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         unless (-r $::XCATROOT . "/share/xcat/install/$platform/$profile.tmpl" | ||||
|                 or -r $::XCATROOT | ||||
|                 . "/share/xcat/install/$platform/$profile.$arch.tmpl" | ||||
|                 or -r $::XCATROOT | ||||
|                 . "/share/xcat/install/$platform/$profile.$os.tmpl" | ||||
|                 or -r $::XCATROOT | ||||
|                 . "/share/xcat/install/$platform/$profile.$genos.tmpl" | ||||
|                 or -r $::XCATROOT | ||||
|                 . "/share/xcat/install/$platform/$profile.$os.$arch.tmpl" | ||||
|                 or -r $::XCATROOT | ||||
|                 . "/share/xcat/install/$platform/$profile.$genos.$arch.tmpl") | ||||
|        | ||||
|         my $tmplfile=get_tmpl_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos); | ||||
|         if (! $tmplfile) { $tmplfile=get_tmpl_file_name("$::XCATROOT/share/xcat/install/$platform", $profile, $os, $arch, $genos); } | ||||
|         unless ( -r "$tmplfile")   | ||||
|         { | ||||
|             $callback->( | ||||
|                         { | ||||
| @@ -459,69 +456,17 @@ sub mkinstall | ||||
|  | ||||
|         #Call the Template class to do substitution to produce a kickstart file in the autoinst dir | ||||
|         my $tmperr = | ||||
|           "Unable to find template in $::XCATROOT/share/xcat/install/$platform (for $profile/$os/$arc combination)"; | ||||
|         if (-r $::XCATROOT | ||||
|             . "/share/xcat/install/$platform/$profile.$os.$arch.tmpl") | ||||
|           "Unable to find template in /install/custom/install/$platform or $::XCATROOT/share/xcat/install/$platform (for $profile/$os/$arch combination)"; | ||||
|         if (-r "$tmplfile") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                     $::XCATROOT | ||||
|                       . "/share/xcat/install/$platform/$profile.$os.$arch.tmpl", | ||||
|                     $tmplfile, | ||||
|                     "/$installroot/autoinst/" . $node, | ||||
|                     $node | ||||
|                     ); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT | ||||
|                . "/share/xcat/install/$platform/$profile.$genos.$arch.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                  $::XCATROOT | ||||
|                    . "/share/xcat/install/$platform/$profile.$genos.$arch.tmpl", | ||||
|                  "/$installroot/autoinst/" . $node, | ||||
|                  $node | ||||
|                  ); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT | ||||
|                . "/share/xcat/install/$platform/$profile.$arch.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                         $::XCATROOT | ||||
|                           . "/share/xcat/install/$platform/$profile.$arch.tmpl", | ||||
|                         "/$installroot/autoinst/" . $node, | ||||
|                         $node | ||||
|                         ); | ||||
|         } | ||||
|         elsif ( | ||||
|              -r $::XCATROOT . "/share/xcat/install/$platform/$profile.$os.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                           $::XCATROOT | ||||
|                             . "/share/xcat/install/$platform/$profile.$os.tmpl", | ||||
|                           "/$installroot/autoinst/" . $node, | ||||
|                           $node | ||||
|                           ); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT | ||||
|                . "/share/xcat/install/$platform/$profile.$genos.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                        $::XCATROOT | ||||
|                          . "/share/xcat/install/$platform/$profile.$genos.tmpl", | ||||
|                        "/$installroot/autoinst/" . $node, | ||||
|                        $node | ||||
|                        ); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT . "/share/xcat/install/$platform/$profile.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                     $::XCATROOT . "/share/xcat/install/$platform/$profile.tmpl", | ||||
|                     "/$installroot/autoinst/" . $node, $node); | ||||
|         } | ||||
|  | ||||
|         if ($tmperr) | ||||
|         { | ||||
|             $callback->( | ||||
| @@ -862,4 +807,34 @@ sub copycd | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub get_tmpl_file_name { | ||||
|   my $base=shift; | ||||
|   my $profile=shift; | ||||
|   my $os=shift; | ||||
|   my $arch=shift; | ||||
|   my $genos=shift; | ||||
|  | ||||
|   if (-r   "$base/$profile.$os.$arch.tmpl") { | ||||
|     return  "base/$profile.$os.$arch.tmpl";      | ||||
|   } | ||||
|   elsif (-r "$base/$profile.$genos.$arch.tmpl") { | ||||
|     return  "$base/$profile.$genos.$arch.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.$arch.tmpl") { | ||||
|     return  "$base/$profile.$arch.tmpl"; | ||||
|   } | ||||
|   elsif ( -r "$base/$profile.$os.tmpl") { | ||||
|     return   "$base/$profile.$os.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.$genos.tmpl") { | ||||
|     return  "$base/$profile.$genos.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.tmpl") { | ||||
|     return  "$base/$profile.tmpl";   | ||||
|   } | ||||
|  | ||||
|   return ""; | ||||
| } | ||||
|  | ||||
|  | ||||
| 1; | ||||
|   | ||||
| @@ -61,19 +61,15 @@ sub process_request { | ||||
|         return; | ||||
|     } | ||||
|     my $oldpath=cwd(); | ||||
|     my $exlistloc; | ||||
|     if (-r "$::XCATROOT/share/xcat/netboot/$distname/$profile.$osver.$arch.exlist") { | ||||
|        $exlistloc = "$::XCATROOT/share/xcat/netboot/$distname/$profile.$osver.$arch.exlist"; | ||||
|     } elsif (-r "$::XCATROOT/share/xcat/netboot/$distname/$profile.$arch.exlist") { | ||||
|        $exlistloc = "$::XCATROOT/share/xcat/netboot/$distname/$profile.$arch.exlist"; | ||||
|     } elsif (-r "$::XCATROOT/share/xcat/netboot/$distname/$profile.$osver.exlist") { | ||||
|        $exlistloc = "$::XCATROOT/share/xcat/netboot/$distname/$profile.$osver.exlist"; | ||||
|     } elsif (-r "$::XCATROOT/share/xcat/netboot/$distname/$profile.exlist") { | ||||
|        $exlistloc = "$::XCATROOT/share/xcat/netboot/$distname/$profile.exlist"; | ||||
|     } else { | ||||
|        $callback->({error=>["Unable to finde file exclusion list under $::XCATROOT/share/xcat/netboot/$distname/ for $profile/$arch/$osver"],errorcode=>[1]}); | ||||
|     my $exlistloc=get_exlist_file_name("$installroot/custom/netboot/$distname", $profile, $osver, $arch); | ||||
|     if (!$exlistloc) {  $exlistloc=get_exlist_file_name("$::XCATROOT/share/xcat/netboot/$distname", $profile, $osver, $arch); } | ||||
|  | ||||
|     if (!$exlistloc) | ||||
|     { | ||||
|        $callback->({error=>["Unable to finde file exclusion list under $installroot/custom/netboot/$distname or $::XCATROOT/share/xcat/netboot/$distname/ for $profile/$arch/$osver"],errorcode=>[1]}); | ||||
|        next; | ||||
|     } | ||||
|     #print "exlistloc=$exlistloc\n"; | ||||
|     my $exlist; | ||||
|     open($exlist,"<",$exlistloc); | ||||
|     my $excludestr = "find . "; | ||||
| @@ -238,3 +234,21 @@ sub copybootscript { | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| sub get_exlist_file_name { | ||||
|     my $base=shift; | ||||
|     my $profile=shift; | ||||
|     my $osver=shift; | ||||
|     my $arch=shift; | ||||
|      | ||||
|     my $exlistloc=""; | ||||
|     if (-r "$base/$profile.$osver.$arch.exlist") { | ||||
|        $exlistloc = "$base/$profile.$osver.$arch.exlist"; | ||||
|     } elsif (-r "$base/$profile.$arch.exlist") { | ||||
|        $exlistloc = "$base/$profile.$arch.exlist"; | ||||
|     } elsif (-r "$base/$profile.$osver.exlist") { | ||||
|        $exlistloc = "$base/$profile.$osver.exlist"; | ||||
|     } elsif (-r "$base/$profile.exlist") { | ||||
|        $exlistloc = "$base/$profile.exlist"; | ||||
|    } | ||||
|     return $exlistloc; | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,10 @@ | ||||
| # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
| package xCAT_plugin::sles; | ||||
| BEGIN | ||||
| { | ||||
|   $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; | ||||
| } | ||||
| use lib "$::XCATROOT/lib/perl"; | ||||
| use Storable qw(dclone); | ||||
| use Sys::Syslog; | ||||
| use File::Temp qw/tempdir/; | ||||
| @@ -272,11 +277,9 @@ sub mkinstall | ||||
|         my $os      = $ent->{os}; | ||||
|         my $arch    = $ent->{arch}; | ||||
|         my $profile = $ent->{profile}; | ||||
|         unless ( -r $::XCATROOT . "/share/xcat/install/sles/$profile.tmpl" | ||||
|               or -r $::XCATROOT . "/share/xcat/install/sles/$profile.$arch.tmpl" | ||||
|               or -r $::XCATROOT . "/share/xcat/install/sles/$profile.$os.tmpl" | ||||
|               or -r $::XCATROOT | ||||
|               . "/share/xcat/install/sles/$profile.$os.$arch.tmpl") | ||||
|         my $tmplfile=get_tmpl_file_name("/install/custom/install/sles", $profile, $os, $arch); | ||||
|         if (! $tmplfile) { $tmplfile=get_tmpl_file_name("$::XCATROOT/share/xcat/install/sles", $profile, $os, $arch); } | ||||
|         unless ( -r "$tmplfile")      | ||||
|         { | ||||
|             $callback->( | ||||
|                       { | ||||
| @@ -290,37 +293,16 @@ sub mkinstall | ||||
|  | ||||
|         #Call the Template class to do substitution to produce a kickstart file in the autoinst dir | ||||
|         my $tmperr; | ||||
|         if (-r $::XCATROOT . "/share/xcat/install/sles/$profile.$os.$arch.tmpl") | ||||
|         if (-r "$tmplfile") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                          $::XCATROOT | ||||
|                            . "/share/xcat/install/sles/$profile.$os.$arch.tmpl", | ||||
|                          $tmplfile, | ||||
|                          "/install/autoinst/$node", | ||||
|                          $node | ||||
|                          ); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT . "/share/xcat/install/sles/$profile.$arch.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                    $::XCATROOT . "/share/xcat/install/sles/$profile.$arch.tmpl", | ||||
|                    "/install/autoinst/$node", $node); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT . "/share/xcat/install/sles/$profile.$os.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                      $::XCATROOT . "/share/xcat/install/sles/$profile.$os.tmpl", | ||||
|                      "/install/autoinst/$node", $node); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT . "/share/xcat/install/sles/$profile.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                          $::XCATROOT . "/share/xcat/install/sles/$profile.tmpl", | ||||
|                          "/install/autoinst/$node", $node); | ||||
|         } | ||||
|  | ||||
|         if ($tmperr) | ||||
|         { | ||||
|             $callback->( | ||||
| @@ -712,4 +694,25 @@ sub copycd | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub get_tmpl_file_name { | ||||
|   my $base=shift; | ||||
|   my $profile=shift; | ||||
|   my $os=shift; | ||||
|   my $arch=shift; | ||||
|   if (-r   "$base/$profile.$os.$arch.tmpl") { | ||||
|     return "$base/$profile.$os.$arch.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.$arch.tmpl") { | ||||
|     return  "$base/$profile.$arch.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.$os.tmpl") { | ||||
|     return  "$base/$profile.$os.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.tmpl") { | ||||
|     return  "$base/$profile.tmpl"; | ||||
|   } | ||||
|  | ||||
|   return ""; | ||||
| } | ||||
|  | ||||
| 1; | ||||
|   | ||||
| @@ -1,5 +1,10 @@ | ||||
| # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
| package xCAT_plugin::windows; | ||||
| BEGIN | ||||
| { | ||||
|   $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; | ||||
| } | ||||
| use lib "$::XCATROOT/lib/perl"; | ||||
| use Storable qw(dclone); | ||||
| use Sys::Syslog; | ||||
| use File::Temp qw/tempdir/; | ||||
| @@ -76,11 +81,9 @@ sub mkinstall | ||||
|         my $os      = $ent->{os}; | ||||
|         my $arch    = $ent->{arch}; | ||||
|         my $profile = $ent->{profile}; | ||||
|         unless ( -r $::XCATROOT . "/share/xcat/install/windows/$profile.tmpl" | ||||
|               or -r $::XCATROOT . "/share/xcat/install/windows/$profile.$arch.tmpl" | ||||
|               or -r $::XCATROOT . "/share/xcat/install/windows/$profile.$os.tmpl" | ||||
|               or -r $::XCATROOT | ||||
|               . "/share/xcat/install/windows/$profile.$os.$arch.tmpl") | ||||
|         my $tmplfile=get_tmpl_file_name("$installroot/custom/install/windows", $profile, $os, $arch); | ||||
|         if (! $tmplfile) { $tmplfile=get_tmpl_file_name("$::XCATROOT/share/xcat/install/windows", $profile, $os, $arch); } | ||||
|         unless ( -r "$tmplfile") | ||||
|         { | ||||
|             $callback->( | ||||
|                       { | ||||
| @@ -94,37 +97,16 @@ sub mkinstall | ||||
|  | ||||
|         #Call the Template class to do substitution to produce an unattend.xml file in the autoinst dir | ||||
|         my $tmperr; | ||||
|         if (-r $::XCATROOT . "/share/xcat/install/windows/$profile.$os.$arch.tmpl") | ||||
|         if (-r "$tmplfile") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                          $::XCATROOT | ||||
|                            . "/share/xcat/install/windows/$profile.$os.$arch.tmpl", | ||||
|                          $tmplfile, | ||||
|                          "/install/autoinst/$node", | ||||
|                          $node | ||||
|                          ); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT . "/share/xcat/install/windows/$profile.$arch.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                    $::XCATROOT . "/share/xcat/install/windows/$profile.$arch.tmpl", | ||||
|                    "/install/autoinst/$node", $node); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT . "/share/xcat/install/windows/$profile.$os.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                      $::XCATROOT . "/share/xcat/install/windows/$profile.$os.tmpl", | ||||
|                      "/install/autoinst/$node", $node); | ||||
|         } | ||||
|         elsif (-r $::XCATROOT . "/share/xcat/install/windows/$profile.tmpl") | ||||
|         { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                          $::XCATROOT . "/share/xcat/install/windows/$profile.tmpl", | ||||
|                          "/install/autoinst/$node", $node); | ||||
|         } | ||||
|          | ||||
|         if ($tmperr) | ||||
|         { | ||||
|             $callback->( | ||||
| @@ -348,4 +330,34 @@ sub copycd | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub get_tmpl_file_name { | ||||
|   my $base=shift; | ||||
|   my $profile=shift; | ||||
|   my $os=shift; | ||||
|   my $arch=shift; | ||||
|   if (-r   "$base/$profile.$os.$arch.tmpl") { | ||||
|     return "$base/$profile.$os.$arch.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.$arch.tmpl") { | ||||
|     return  "$base/$profile.$arch.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.$os.tmpl") { | ||||
|     return  "$base/$profile.$os.tmpl"; | ||||
|   } | ||||
|   elsif (-r "$base/$profile.tmpl") { | ||||
|     return  "$base/$profile.tmpl"; | ||||
|   } | ||||
|  | ||||
|   return ""; | ||||
| } | ||||
|  | ||||
|  | ||||
| 1; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user