aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/Chroot.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Iurt/Chroot.pm')
-rw-r--r--lib/Iurt/Chroot.pm27
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index 9b465de..42974bc 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -49,7 +49,7 @@ sub clean_chroot {
system("$sudo umount $chroot/var/cache/icecream &> /dev/null");
}
if (-d "$chroot/urpmi_medias/") {
- system ("$sudo umount $chroot/urpmi_medias/*");
+ system ("$sudo umount $chroot/urpmi_medias");
}
sudo($run, $config, '--rm', '-r', $chroot);
}
@@ -75,21 +75,16 @@ sub clean_chroot {
system("$sudo mount -o bind /var/cache/icecream $chroot/var/cache/icecream &>/dev/null") and return;
}
- my $count = 0;
- foreach my $m (@{$run->{additional_media}}) {
- if (($m =~ m/^(http:|ftp:)/)) {
- next;
+ if ($run->{additional_media} && $run->{additional_media}{repository}) {
+ my $rep = $run->{additional_media}{repository};
+ if (!($rep =~ m/^(http:|ftp:)/)) {
+ my $mount_point = "$chroot/urpmi_medias";
+ my $bind;
+ my $url = $rep;
+ $url =~ s!^file://!!;
+ system("$sudo mkdir -p $mount_point");
+ system("$sudo mount -o bind $url $mount_point") and return;
}
- my $mount_point = "$chroot/urpmi_medias/$count";
- my $bind;
- my ($url) = $m;
- $url =~ s!^(http://|ftp://|file://)!!;
- if (($m =~ m/^(file:)/)) {
- $bind = "-o bind";
- }
- system("$sudo mkdir -p $mount_point");
- system("$sudo mount $bind $url $mount_point") and return;
- $count++;
}
1;
}
@@ -500,7 +495,7 @@ sub build_chroot {
system("$sudo umount $tmp_chroot/var/cache/icecream &> /dev/null");
}
if (-d "$tmp_chroot/urpmi_medias/") {
- system ("$sudo umount $tmp_chroot/urpmi_medias/*");
+ system ("$sudo umount $tmp_chroot/urpmi_medias");
}
return !system($sudo, 'tar', 'czf', $chroot_tar, '-C', $tmp_chroot, '.');
}