diff options
author | Marcelo Leitner <mrl@mandriva.com> | 2007-06-19 14:00:10 +0000 |
---|---|---|
committer | Marcelo Leitner <mrl@mandriva.com> | 2007-06-19 14:00:10 +0000 |
commit | 6141ed458a08389136e0a89878bb33b96e5ca6f4 (patch) | |
tree | 97e05ac8e644c242926b003ad61c42a5d6deda1d | |
parent | 0da39ff630055089cfb3716a51a6d9bb15f4ab99 (diff) | |
download | iurt-6141ed458a08389136e0a89878bb33b96e5ca6f4.tar iurt-6141ed458a08389136e0a89878bb33b96e5ca6f4.tar.gz iurt-6141ed458a08389136e0a89878bb33b96e5ca6f4.tar.bz2 iurt-6141ed458a08389136e0a89878bb33b96e5ca6f4.tar.xz iurt-6141ed458a08389136e0a89878bb33b96e5ca6f4.zip |
- Protect chroot removal if there is still mount points referencing it.
- Also list our two new mountpoints in yet other chroot cleanup function.
-rw-r--r-- | lib/Iurt/Chroot.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index 42974bc..338f40d 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -51,6 +51,16 @@ sub clean_chroot { if (-d "$chroot/urpmi_medias/") { system ("$sudo umount $chroot/urpmi_medias"); } + + # Do not run rm if there is something still mounted there + open (my $FP, "/proc/mounts") or die $!; + my @list = grep { /$chroot/ } <$FP>; + close ($FP); + if ($#list >= 0) { + # Still referenced + return 1; + } + sudo($run, $config, '--rm', '-r', $chroot); } @@ -326,7 +336,7 @@ sub clean_chroot_tmp { my ($run, $chroot_dir, $dir) = @_; my $d = "$chroot_dir/$dir"; - foreach my $m ('proc', 'dev/pts') { + foreach my $m ('proc', 'dev/pts', 'urpmi_medias', 'var/cache/icecream') { if (system("$sudo umount $d/$m &>/dev/null") && $run->{verbose} > 1) { plog("ERROR: could not umount /$m in $d/"); } |