diff --git a/perl-xCAT-2.0/xCAT/Yum.pm b/perl-xCAT-2.0/xCAT/Yum.pm index 8cf67f479..92b6dac58 100644 --- a/perl-xCAT-2.0/xCAT/Yum.pm +++ b/perl-xCAT-2.0/xCAT/Yum.pm @@ -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; diff --git a/xCAT-server-2.0/lib/xcat/plugins/sles.pm b/xCAT-server-2.0/lib/xcat/plugins/sles.pm index c77a10787..1501a90f0 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/sles.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/sles.pm @@ -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; diff --git a/xCAT-server-2.0/share/xcat/install/scripts/post.rh b/xCAT-server-2.0/share/xcat/install/scripts/post.rh index cb9bb749e..a66cb0182 100644 --- a/xCAT-server-2.0/share/xcat/install/scripts/post.rh +++ b/xCAT-server-2.0/share/xcat/install/scripts/post.rh @@ -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 diff --git a/xCAT-server-2.0/share/xcat/install/scripts/post.rh.iscsi b/xCAT-server-2.0/share/xcat/install/scripts/post.rh.iscsi index 6b24544c6..397ae3228 100644 --- a/xCAT-server-2.0/share/xcat/install/scripts/post.rh.iscsi +++ b/xCAT-server-2.0/share/xcat/install/scripts/post.rh.iscsi @@ -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 diff --git a/xCAT/postscripts/addsiteyum b/xCAT/postscripts/addsiteyum new file mode 100644 index 000000000..132e9d0b7 --- /dev/null +++ b/xCAT/postscripts/addsiteyum @@ -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