aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/Urpmi.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Iurt/Urpmi.pm')
-rw-r--r--lib/Iurt/Urpmi.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm
index 259b81e..00e4a12 100644
--- a/lib/Iurt/Urpmi.pm
+++ b/lib/Iurt/Urpmi.pm
@@ -113,6 +113,7 @@ sub urpmi_command {
foreach my $m (@{$run->{additional_media}{media}}) {
my $name = "$run->{additional_media}{repository}_$m";
$name =~ s![/:]!_!g;
+
my $url;
if (($run->{additional_media}{repository} =~ m!^(http:|ftp:)!)) {
$url = $run->{additional_media}{repository};
@@ -120,6 +121,16 @@ sub urpmi_command {
else {
$url = "/urpmi_medias/$run->{distro}/$m";
}
+
+ # Check if the media is not empty, as add_media will abort if it fails
+ opendir (my $DP, $url) or next;
+ my @contents = readdir $DP;
+ close ($DP);
+ if ($#contents <= 1) {
+ # Just entries: . ..
+ continue;
+ }
+
if (!add_media($self, $chroot_tmp, $name, "$name $url")) {
plog("ERROR: Unable to add media $m");
}