aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-04-17 20:50:26 +0000
committerThierry Vignaud <tv@mageia.org>2012-04-17 20:50:26 +0000
commit1cf4853a18cf5682c856709f3fbea1c41631819e (patch)
tree8b9be2ae73082df684ec4d43689fe0175b6d952a /lib/Iurt
parent043bdaac34236a8505238dc8d99a6822fe0c3107 (diff)
downloadiurt-1cf4853a18cf5682c856709f3fbea1c41631819e.tar
iurt-1cf4853a18cf5682c856709f3fbea1c41631819e.tar.gz
iurt-1cf4853a18cf5682c856709f3fbea1c41631819e.tar.bz2
iurt-1cf4853a18cf5682c856709f3fbea1c41631819e.tar.xz
iurt-1cf4853a18cf5682c856709f3fbea1c41631819e.zip
(_setup_additional_media) split it out of clean_chroot()
Diffstat (limited to 'lib/Iurt')
-rw-r--r--lib/Iurt/Chroot.pm31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index 25949bd..c2fe78e 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -87,20 +87,27 @@ sub clean_chroot {
}
if ($run->{additional_media} && $run->{additional_media}{repository}) {
- my $rep = $run->{additional_media}{repository};
- if (urpm::is_local_url($rep)) {
- my $mount_point = "$chroot/urpmi_medias";
- my $url = urpm::file_from_local_url($rep);
- sudo($config, '--mkdir', '-p', $mount_point);
- if (!sudo($config, '--bindmount', $url, $mount_point)) {
- plog('ERROR', "Failed to mount $url on $mount_point");
- _clean_mounts($run, $config, $chroot);
- return;
- }
- }
+ _setup_additional_media($run, $config, $chroot) or return;
}
1;
-}
+}
+
+sub _setup_additional_media {
+ my ($run, $config, $chroot) = @_;
+ my $rep = $run->{additional_media}{repository};
+
+ return 1 if !urpm::is_local_url($rep);
+
+ my $mount_point = "$chroot/urpmi_medias";
+ my $url = urpm::file_from_local_url($rep);
+ sudo($config, '--mkdir', '-p', $mount_point);
+ if (!sudo($config, '--bindmount', $url, $mount_point)) {
+ plog('ERROR', "Failed to mount $url on $mount_point");
+ _clean_mounts($run, $config, $chroot);
+ return;
+ }
+ 1;
+}
sub _clean_mounts {
my ($run, $config, $chroot) = @_;