From d249091d7776f2f432c6d66a864c6c452dc83f6e Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 27 Jul 2010 18:16:27 +0000 Subject: [PATCH] updating os pkgs using updatenode: sles full install support git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6875 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/sles.pm | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 38f160543..8f83781d3 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -443,6 +443,7 @@ sub mkinstall my $profile; my $tmplfile; my $pkgdir; + my $pkglistfile; my $osinst; my $ent = $ntents->{$node}->[0]; @@ -462,7 +463,7 @@ sub mkinstall if (!$linuximagetab) { $linuximagetab=xCAT::Table->new('linuximage', -create=>1); } - (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'template', 'pkgdir'); + (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'template', 'pkgdir', 'pkglist'); if ($ref1) { if ($ref1->{'template'}) { $img_hash{$imagename}->{template}=$ref1->{'template'}; @@ -470,6 +471,9 @@ sub mkinstall if ($ref1->{'pkgdir'}) { $img_hash{$imagename}->{pkgdir}=$ref1->{'pkgdir'}; } + if ($ref1->{'pkglist'}) { + $img_hash{$imagename}->{pkglist}=$ref1->{'pkglist'}; + } } } else { $callback->( @@ -488,6 +492,7 @@ sub mkinstall if (!$pkgdir) { $pkgdir="$installroot/$os/$arch"; } + $pkglistfile=$ph->{pkglist}; } else { $os = $ent->{os}; @@ -505,6 +510,10 @@ sub mkinstall } $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$plat", $profile, $os, $arch); if (! $tmplfile) { $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$::XCATROOT/share/xcat/install/$plat", $profile, $os, $arch); } + + $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$plat", $profile, $os, $arch); + if (! $pkglistfile) { $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$::XCATROOT/share/xcat/install/$plat", $profile, $os, $arch); } + $pkgdir="$installroot/$os/$arch"; } @@ -533,17 +542,29 @@ sub mkinstall next; } + #substitute the tag #INCLUDE_DEFAULT_PKGS# with package file name + $new_tmplfile=$tmplfile; + if ($pkglistfile) { + $pkglistfile =~ s/\//\\\//g; + #print "pkglistfile=$pkglistfile\n"; + system("sed -e \"s/#INCLUDE_DEFAULT_PKGLIST#/#INCLUDE_PKGLIST:$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; - if (-r "$tmplfile") + if (-r "$new_tmplfile") { $tmperr = xCAT::Template->subvars( - $tmplfile, + $new_tmplfile, "$installroot/autoinst/$node", $node ); } + system("rm -f /tmp/xcattemp.tmpl"); if ($tmperr) {