-Attempt to setup yum.repos.d on installing nodes to reach install server

-Fix SLES issue where admin supplied distname was ignored


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@898 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-03-26 15:04:32 +00:00
parent 0322d35934
commit 6c59e72c63
5 changed files with 41 additions and 6 deletions

View File

@ -1,16 +1,25 @@
package xCAT::Yum;
use DBI;
use File::Find;
use File::Spec;
use File::Path;
my $yumrepofile;
my $distname;
my $arch;
my $installpfx;
sub localize_yumrepo {
my $self = shift;
my $installroot = shift;
my $distname = shift;
my $arch = shift;
$distname = shift;
$arch = shift;
my $dosqlite = 0;
my $repomdfile;
my $primaryxml;
my $dirlocation = "$installroot/$distname/$arch/";
find(\&check_tofix,$dirlocation);
$installpfx = "$installroot/$distname/$arch/";
mkpath("$installroot/postscripts/repos/$distname/$arch/");
open($yumrepofile,">","$installroot/postscripts/repos/$distname/$arch/mediarepo.tmpl");
find(\&check_tofix,$installpfx);
close($yumrepofile);
}
sub check_tofix {
if (-d $File::Find::name and $File::Find::name =~ /\/repodata$/) {
@ -19,6 +28,16 @@ sub check_tofix {
}
sub fix_directory {
my $dirlocation = shift;
my @dircomps = File::Spec->splitdir($dirlocation);
pop(@dircomps);
my $yumurl = File::Spec->catdir(@dircomps);
$yumurl =~ s!$installpfx!http://#INSTSERVER#/install/$distname/$arch/!;
my $reponame = $dircomps[$#dircomps];
print $yumrepofile "[$distname-$arch-$reponame]\n";
print $yumrepofile "name=xCAT configured yum repository for $distname/$arch/$reponame\n";
print $yumrepofile "baseurl=$yumurl\n";
print $yumrepofile "enabled=1\n";
print $yumrepofile "gpgcheck=0\n\n";
my $oldsha=`/usr/bin/sha1sum $dirlocation/primary.xml.gz`;
my $olddbsha;
my @xmlines;

View File

@ -354,7 +354,7 @@ sub copycd
{
my @parts = split /\s+/, $prod;
my @subparts = split /-/, $parts[2];
$distname = "sles" . $subparts[0];
unless ($distname) { $distname = "sles" . $subparts[0] };
}
}
}
@ -381,7 +381,8 @@ sub copycd
$callback->(
{
error =>
"Requested SLES architecture $arch, but media is $darch"
["Requested SLES architecture $arch, but media is $darch"],
errorcode => [1]
}
);
return;

View File

@ -51,6 +51,11 @@ do
done
tar -xvf xcatpost.tar.bz2
/xcatpost/#TABLE:nodelist:THISNODE:node#
export NODE=#TABLE:nodelist:THISNODE:node#
export PATH=/xcatpost:$PATH
export OSVER=#TABLE:nodetype:THISNODE:os#
export ARCH=#TABLE:nodetype:THISNODE:arch#
addsiteyum
cd /
rm -Rf /xcatpost
exit 0

View File

@ -53,6 +53,9 @@ tar -xvf xcatpost.tar.bz2
/xcatpost/#TABLE:nodelist:THISNODE:node#
export NODE=#TABLE:nodelist:THISNODE:node#
export PATH=/xcatpost:$PATH
export OSVER=#TABLE:nodetype:THISNODE:os#
export ARCH=#TABLE:nodetype:THISNODE:arch#
addsiteyum
uploadboot
cd /
rm -Rf /xcatpost

View File

@ -0,0 +1,7 @@
#!/bin/sh
for i in /install/postscripts/repos/$OSVER/$ARCH/*
do
TARGFILE=`basename $i`
TARGFILE=`echo $TARGFILE|sed -e s/.tmpl$//`
sed -e s!#INSTSERVER#!$MASTER! $i > /etc/yum/repos.d/$TARGFILE
done