Remove files inside the auxfiles directory

This is fixing the error:
  cannot rmdir /var/lib/apt/lists/auxfiles: Directory not empty at ./mmdebstrap/mmdebstrap line 3084.
which happens when using apt-transport-mirror.
This commit is contained in:
Nicolas Vigier 2021-06-13 09:58:27 +02:00 committed by Johannes Schauer Marin Rodrigues
parent ea82b267c9
commit 5283d74dfe
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -3016,8 +3016,15 @@ sub run_cleanup() {
# apt since 1.6 creates the auxfiles directory. If apt inside the # apt since 1.6 creates the auxfiles directory. If apt inside the
# chroot is older than that, then it will not know how to clean it. # chroot is older than that, then it will not know how to clean it.
if (-e "$options->{root}/var/lib/apt/lists/auxfiles") { if (-e "$options->{root}/var/lib/apt/lists/auxfiles") {
rmdir "$options->{root}/var/lib/apt/lists/auxfiles" remove_tree("$options->{root}/var/lib/apt/lists/auxfiles",
or die "cannot rmdir /var/lib/apt/lists/auxfiles: $!"; { error => \my $err });
if (@$err) {
for my $diag (@$err) {
my ($file, $message) = %$diag;
if ($file eq '') { warning "general error: $message"; }
else { warning "problem unlinking $file: $message"; }
}
}
} }
} }