From b2d5a45932a303a65baa4ec5081c5fa1f4fa80a5 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Tue, 23 Apr 2019 13:28:55 +0200 Subject: [PATCH] cleanup auxfiles *after* running apt-get update or otherwise it will be re-created --- coverage.sh | 2 -- mmdebstrap | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/coverage.sh b/coverage.sh index 6de1ee9..013f0fa 100755 --- a/coverage.sh +++ b/coverage.sh @@ -156,8 +156,6 @@ grep -v '^Priority: ' /tmp/debian-$dist-mm/var/lib/dpkg/status > status2 diff -u status1 status2 rm status1 status2 rm /tmp/debian-$dist-debootstrap/var/lib/dpkg/status /tmp/debian-$dist-mm/var/lib/dpkg/status -# this file is only created by apt 1.6 or newer -rmdir /tmp/debian-$dist-mm/var/lib/apt/lists/auxfiles # debootstrap exposes the hosts's kernel version rm /tmp/debian-$dist-debootstrap/etc/apt/apt.conf.d/01autoremove-kernels \ /tmp/debian-$dist-mm/etc/apt/apt.conf.d/01autoremove-kernels diff --git a/mmdebstrap b/mmdebstrap index 1a162f4..2b29651 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1667,18 +1667,18 @@ sub setup { # clean up temporary configuration file unlink "$options->{root}/etc/apt/apt.conf.d/00mmdebstrap" or error "failed to unlink /etc/apt/apt.conf.d/00mmdebstrap: $!"; - # 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. - if (-e "$options->{root}/var/lib/apt/lists/auxfiles") { - rmdir "$options->{root}/var/lib/apt/lists/auxfiles" or die "cannot rmdir /var/lib/apt/lists/auxfiles: $!"; - } - info "cleaning package lists and apt cache..."; run_apt_progress({ ARGV => ['apt-get', '--option', 'Dir::Etc::SourceList=/dev/null', 'update'], }); run_apt_progress({ ARGV => ['apt-get', 'clean'] }); + # 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. + if (-e "$options->{root}/var/lib/apt/lists/auxfiles") { + rmdir "$options->{root}/var/lib/apt/lists/auxfiles" or die "cannot rmdir /var/lib/apt/lists/auxfiles: $!"; + } + if (defined $options->{qemu} and $options->{mode} ne 'proot' and $options->{mode} ne 'fakechroot') { unlink "$options->{root}/usr/bin/qemu-$options->{qemu}-static" or error "cannot unlink /usr/bin/qemu-$options->{qemu}-static: $!"; }