2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-13 15:00:15 +00:00

Added support for remote repos in pkgdir (#1614)

This allows for remote repositories to be used for image creation.
This commit is contained in:
Jesse Hanley
2016-08-03 23:08:04 -04:00
committed by yangsong
parent b6e4915010
commit c5121bce0f

View File

@@ -265,12 +265,17 @@ unless ($onlyinitrd) {
@yumdirs = ();
my @pkgdirs = split(",", $srcdir);
my @pkgdir_internet; #Put all of the http mirrors in this array
my $dir;
foreach $dir (@pkgdirs) {
if ($dir =~ /^http.*/) {
push @pkgdir_internet, $dir;
} else {
find(\&isyumdir, <$dir/>);
if (!grep /$dir/, @yumdirs) {
print "The repository for $dir should be created before running the genimge. Try to run [createrepo $dir].\n";
}
}
}
# Add the dir for kernel rpm to be installed
@@ -280,8 +285,8 @@ unless ($onlyinitrd) {
print "The repository for $kerneldir should be created before running the genimge. Try to run [createrepo $kerneldir].\n";
}
}
unless (scalar(@yumdirs)) {
print "Need $installroot/$osver/$arch/ available from a system that has ran copycds on $osver $arch\n";
unless (scalar(@yumdirs) || scalar(@pkgdir_internet)) {
print "Need $installroot/$osver/$arch/ available from a system that has ran copycds on $osver $arch or correct web repo\n";
exit 1;
}
@@ -300,6 +305,10 @@ unless ($onlyinitrd) {
print $yumconfig "[$osver-$arch-$repnum]\nname=$osver-$arch-$repnum\nbaseurl=file://$srcdir\ngpgpcheck=0\n\n";
$repnum += 1;
}
foreach $srcdir (@pkgdir_internet) {
print $yumconfig "[$osver-$arch-$repnum]\nname=$osver-$arch-$repnum\nbaseurl=$srcdir\ngpgpcheck=0\n\n";
$repnum += 1;
}
$repnum -= 1;
close($yumconfig);
mkpath "$rootimg_dir/etc";