From 60f047ba665b9bf4239973f20d6074c3450fa019 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sun, 23 Sep 2018 19:45:09 +0200 Subject: [PATCH] rmdir /var/lib/apt/lists/auxfiles which is created by apt >= 1.6 but unknown to older apt inside the chroot --- mmdebstrap | 3 +++ test.sh | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mmdebstrap b/mmdebstrap index b19b35d..4ea2d49 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -973,6 +973,9 @@ sub setup { # clean up temporary configuration file unlink "$options->{root}/etc/apt/apt.conf.d/00mmdebstrap" or die "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. + rmdir "$options->{root}/var/lib/apt/lists/auxfiles" or die "cannot rmdir /var/lib/apt/lists/auxfiles: $!"; # if there is no apt inside the chroot, clean it from the outside if ($options->{variant} eq 'essential') { $ENV{"APT_CONFIG"} = "$tmpfile"; diff --git a/test.sh b/test.sh index a92eee6..b6e85d0 100755 --- a/test.sh +++ b/test.sh @@ -108,7 +108,10 @@ for dist in stable testing unstable; do diff -u status1 status2 rm status1 status2 sudo rm debian-$dist-debootstrap/var/lib/dpkg/status debian-$dist-mm/var/lib/dpkg/status - sudo rmdir debian-$dist-mm/var/lib/apt/lists/auxfiles + # this file is only created by apt 1.6 or newer + if [ "$dist" != "stable" ]; then + sudo rmdir debian-$dist-mm/var/lib/apt/lists/auxfiles + fi # debootstrap exposes the hosts's kernel version sudo rm debian-$dist-debootstrap/etc/apt/apt.conf.d/01autoremove-kernels \ debian-$dist-mm/etc/apt/apt.conf.d/01autoremove-kernels