From 4a049ff09f84a1ad053e6f130a7cc83a2a8f2a34 Mon Sep 17 00:00:00 2001 From: angli-xcat Date: Mon, 27 Jun 2011 09:29:27 +0000 Subject: [PATCH] Yum.pm should be invoked only when we use rhels5 medias for "copycd" command. In case of multiple unexpected errors when using other distributions. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9948 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Yum.pm | 33 ++++++++++++++++++------ xCAT-server/lib/xcat/plugins/anaconda.pm | 5 +++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/perl-xCAT/xCAT/Yum.pm b/perl-xCAT/xCAT/Yum.pm index 6ff90907b..963b15b66 100644 --- a/perl-xCAT/xCAT/Yum.pm +++ b/perl-xCAT/xCAT/Yum.pm @@ -44,6 +44,15 @@ sub fix_directory { print $yumrepofile "enabled=1\n"; print $yumrepofile "gpgcheck=0\n\n"; + $grep_result = system("grep sha256 $dirlocation/repomd.xml|grep \\connect("dbi:SQLite:$dirlocation/primary.sqlite","","",{AutoCommit=>1}); $pdbh->do('UPDATE "packages" SET "location_base" = NULL'); $pdbh->disconnect; - $newdbopensha=`/usr/bin/sha1sum $dirlocation/primary.sqlite`; + $newdbopensha=`/usr/bin/$sha_command $dirlocation/primary.sqlite`; $newdbopensha =~ s/\s.*//; chomp($newdbopensha); system("/usr/bin/bzip2 $dirlocation/primary.sqlite"); - $newdbsha=`/usr/bin/sha1sum $dirlocation/primary.sqlite.bz2`; + $newdbsha=`/usr/bin/$sha_command $dirlocation/primary.sqlite.bz2`; $newdbsha =~ s/\s.*//; chomp($newdbsha); } @@ -130,6 +139,14 @@ sub fix_directory { #update repomd.xml open($primaryxml,"+<$dirlocation/repomd.xml"); while (<$primaryxml>) { + if($_ =~ m/\/) + { + next; + } + if($_ =~ m/\/) + { + next; + } s!xml:base="media://[^"]*"!!g; if(defined($oldsha)){ s!$oldsha!$newsha!g; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 976ebc106..d8394e49f 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -1410,7 +1410,10 @@ sub copycd #my $rc = system("cd $path;rsync -a . $installroot/$distname/$arch/"); chmod 0755, "$installroot/$distname/$arch"; require xCAT::Yum; - xCAT::Yum->localize_yumrepo($installroot, $distname, $arch); + if($distname =~ /rhels5/) + { + xCAT::Yum->localize_yumrepo($installroot, $distname, $arch); + } if ($rc != 0) { $callback->({error => "Media copy operation failed, status $rc"});