diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-04-17 20:50:23 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-04-17 20:50:23 +0000 |
commit | 043bdaac34236a8505238dc8d99a6822fe0c3107 (patch) | |
tree | 5cd7358f1d46d891052d07271baac5da69d14b8d /lib | |
parent | 34fed4809b00a0b63a5a3a3cb761f8b003d65d29 (diff) | |
download | iurt-043bdaac34236a8505238dc8d99a6822fe0c3107.tar iurt-043bdaac34236a8505238dc8d99a6822fe0c3107.tar.gz iurt-043bdaac34236a8505238dc8d99a6822fe0c3107.tar.bz2 iurt-043bdaac34236a8505238dc8d99a6822fe0c3107.tar.xz iurt-043bdaac34236a8505238dc8d99a6822fe0c3107.zip |
(_clean_mounts) factorize cleaning
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/Chroot.pm | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index a897d5d..25949bd 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -40,11 +40,7 @@ sub clean_chroot { plog('DEBUG', "clean chroot"); if (-d $chroot) { - sudo($config, "--umount", "$chroot/proc"); - sudo($config, "--umount", "$chroot/dev/pts"); - if ($run->{icecream}) { - sudo($config, "--umount", "$chroot/var/cache/icecream"); - } + _clean_mounts($run, $config, $chroot); if (-d "$chroot/urpmi_medias/") { sudo($config, "--umount", "$chroot/urpmi_medias"); } @@ -85,8 +81,7 @@ sub clean_chroot { system("$sudo mkdir -p $chroot/var/cache/icecream"); if (!sudo($config, '--bindmount', "/var/cache/icecream", "$chroot/var/cache/icecream")) { plog('ERROR', "Failed to mount var/cache/icecream"); - sudo($config, "--umount", "$chroot/proc"); - sudo($config, "--umount", "$chroot/dev/pts"); + _clean_mounts($run, $config, $chroot); return; } } @@ -99,11 +94,7 @@ sub clean_chroot { sudo($config, '--mkdir', '-p', $mount_point); if (!sudo($config, '--bindmount', $url, $mount_point)) { plog('ERROR', "Failed to mount $url on $mount_point"); - sudo($config, "--umount", "$chroot/proc"); - sudo($config, "--umount", "$chroot/dev/pts"); - if ($run->{icecream}) { - sudo($config, "--umount", "$chroot/var/cache/icecream"); - } + _clean_mounts($run, $config, $chroot); return; } } @@ -111,6 +102,16 @@ sub clean_chroot { 1; } +sub _clean_mounts { + my ($run, $config, $chroot) = @_; + sudo($config, "--umount", "$chroot/proc"); + sudo($config, "--umount", "$chroot/dev/pts"); + + if ($run->{icecream}) { + sudo($config, "--umount", "$chroot/var/cache/icecream"); + } +} + sub dump_rpmmacros { my ($run, $config, $file) = @_; my $f; |