From 6f7b8803bb55a1582d1387e0fbe7aca2fca6db1c Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Fri, 11 Jun 2021 17:36:06 +0200 Subject: [PATCH 1/2] Install apt-transport-https and ca-certificates when using mirror+https urls --- mmdebstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmdebstrap b/mmdebstrap index 730bd1a..808b67a 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -2865,7 +2865,7 @@ sub run_install() { '--format', '$(URI)', 'Created-By: Packages') or error "cannot start apt-get indextargets: $!"; while (my $uri = <$pipe_apt>) { - if ($uri =~ /^https:\/\//) { + if ($uri =~ /^(mirror\+)?https:\/\//) { info "https mirror found -- adding apt-transport-https " . "and ca-certificates"; # FIXME: support for https is part of apt >= 1.5 -- 2.39.2 From 028d4914a037f2fdf74a596345ee44446b061ccf Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Sun, 13 Jun 2021 09:58:27 +0200 Subject: [PATCH 2/2] 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. --- mmdebstrap | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 808b67a..6588917 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -3081,8 +3081,15 @@ sub run_cleanup() { # 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: $!"; + remove_tree("$options->{root}/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"; } + } + } } } -- 2.39.2