also delete everything in /run and add --skip=cleanup/run
This commit is contained in:
parent
add9412a47
commit
0af22912f7
3 changed files with 30 additions and 9 deletions
27
mmdebstrap
27
mmdebstrap
|
@ -3033,10 +3033,31 @@ sub run_cleanup() {
|
|||
}
|
||||
}
|
||||
|
||||
if (any { $_ eq 'cleanup/run' } @{ $options->{skip} }) {
|
||||
info "skipping cleanup/run as requested";
|
||||
} else {
|
||||
# remove any possible leftovers in /run
|
||||
if (-d "$options->{root}/run") {
|
||||
opendir(my $dh, "$options->{root}/run")
|
||||
or error "Can't opendir($options->{root}/run): $!";
|
||||
while (my $entry = readdir $dh) {
|
||||
# skip the "." and ".." entries
|
||||
next if $entry eq ".";
|
||||
next if $entry eq "..";
|
||||
debug "deleting files in /run: $entry";
|
||||
0 == system(
|
||||
'rm', '--interactive=never',
|
||||
'--recursive', '--preserve-root',
|
||||
'--one-file-system', "$options->{root}/run/$entry"
|
||||
) or error "rm failed: $?";
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
if (any { $_ eq 'cleanup/tmp' } @{ $options->{skip} }) {
|
||||
info "skipping cleanup/tmp as requested";
|
||||
} else {
|
||||
# remove any possible leftovers in /tmp but warn about it
|
||||
# remove any possible leftovers in /tmp
|
||||
if (-d "$options->{root}/tmp") {
|
||||
opendir(my $dh, "$options->{root}/tmp")
|
||||
or error "Can't opendir($options->{root}/tmp): $!";
|
||||
|
@ -3044,7 +3065,7 @@ sub run_cleanup() {
|
|||
# skip the "." and ".." entries
|
||||
next if $entry eq ".";
|
||||
next if $entry eq "..";
|
||||
warning "deleting files in /tmp: $entry";
|
||||
debug "deleting files in /tmp: $entry";
|
||||
0 == system(
|
||||
'rm', '--interactive=never',
|
||||
'--recursive', '--preserve-root',
|
||||
|
@ -6839,6 +6860,8 @@ Performs cleanup tasks, unless B<--skip=cleanup> is used:
|
|||
|
||||
=back
|
||||
|
||||
=item * Remove everything in F</run> inside the chroot. This can be disabled using B<--skip=cleanup/run>.
|
||||
|
||||
=item * Remove everything in F</tmp> inside the chroot. This can be disabled using B<--skip=cleanup/tmp>.
|
||||
|
||||
=back
|
||||
|
|
|
@ -34,6 +34,9 @@ rm /tmp/debian-debootstrap/var/log/dpkg.log \
|
|||
/tmp/debian-debootstrap/var/log/alternatives.log \
|
||||
/tmp/debian-mm/var/log/bootstrap.log
|
||||
|
||||
# clear out /run
|
||||
rm -r /tmp/debian-debootstrap/run/*
|
||||
|
||||
# debootstrap doesn't clean apt
|
||||
rm /tmp/debian-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_unstable_main_binary-{{ HOSTARCH }}_Packages \
|
||||
/tmp/debian-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_unstable_Release \
|
||||
|
|
|
@ -95,13 +95,8 @@ fi
|
|||
if [ -e /tmp/debian-{{ DIST }}-mm/etc/apt/apt.conf.d/01autoremove-kernels ]; then
|
||||
rm /tmp/debian-{{ DIST }}-mm/etc/apt/apt.conf.d/01autoremove-kernels
|
||||
fi
|
||||
# who creates /run/mount?
|
||||
if [ -e "/tmp/debian-{{ DIST }}-debootstrap/run/mount/utab" ]; then
|
||||
rm "/tmp/debian-{{ DIST }}-debootstrap/run/mount/utab"
|
||||
fi
|
||||
if [ -e "/tmp/debian-{{ DIST }}-debootstrap/run/mount" ]; then
|
||||
rmdir "/tmp/debian-{{ DIST }}-debootstrap/run/mount"
|
||||
fi
|
||||
# clear out /run
|
||||
rm -r /tmp/debian-{{ DIST }}-debootstrap/run/*
|
||||
# debootstrap doesn't clean apt
|
||||
rm /tmp/debian-{{ DIST }}-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_{{ DIST }}_main_binary-{{ HOSTARCH }}_Packages \
|
||||
/tmp/debian-{{ DIST }}-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_{{ DIST }}_Release \
|
||||
|
|
Loading…
Reference in a new issue