add --keyring option as a shorthand for --aptopt='Dir::Etc::Trusted...

pull/1/head
parent 6cac8e70e8
commit a2cd0e9843
Signed by: josch
GPG Key ID: F2CBA5C78FBD83E1

@ -52,7 +52,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then
fi
starttime=
total=108
total=109
i=1
print_header() {
@ -910,6 +910,25 @@ else
./run_null.sh SUDO
fi
print_header "mode=root,variant=apt: test --keyring"
cat << END > shared/test.sh
#!/bin/sh
set -eu
export LC_ALL=C.UTF-8
echo 'Acquire::Languages "none";' > config
$CMD --mode=root --variant=apt --aptopt='Acquire::Check-Valid-Until "false"' --keyring=/usr/share/keyrings/debian-archive-keyring.gpg --keyring=/usr/share/keyrings/ --aptopt=config $DEFAULT_DIST /tmp/debian-chroot $mirror
cat /tmp/debian-chroot/etc/apt/apt.conf.d/99mmdebstrap
printf 'Acquire::Check-Valid-Until "false";\nDir::Etc::Trusted "/usr/share/keyrings/debian-archive-keyring.gpg";\nDir::Etc::TrustedParts "/usr/share/keyrings/";\nAcquire::Languages "none";\n' | cmp /tmp/debian-chroot/etc/apt/apt.conf.d/99mmdebstrap -
rm /tmp/debian-chroot/etc/apt/apt.conf.d/99mmdebstrap
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
rm -r /tmp/debian-chroot
END
if [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh
else
./run_null.sh SUDO
fi
print_header "mode=root,variant=apt: test --dpkgopt"
cat << END > shared/test.sh
#!/bin/sh

@ -1819,6 +1819,20 @@ sub main() {
'mode=s' => \$options->{mode},
'dpkgopt=s@' => \$options->{dpkgopts},
'aptopt=s@' => \$options->{aptopts},
'keyring=s' => sub {
my ($opt_name, $opt_value) = @_;
if ($opt_value =~ /"/) {
error "apt cannot handle paths with double quotes";
}
if (! -e $opt_value) {
error "keyring \"$opt_value\" does not exist";
}
if (-d $opt_value) {
push @{$options->{aptopts}}, "Dir::Etc::TrustedParts \"$opt_value\"";
} else {
push @{$options->{aptopts}}, "Dir::Etc::Trusted \"$opt_value\"";
}
},
's|silent' => sub { $verbosity_level = 0; },
'q|quiet' => sub { $verbosity_level = 0; },
'v|verbose' => sub { $verbosity_level = 2; },
@ -2745,6 +2759,19 @@ Example: Minimizing the number of packages installed from experimental
--aptopt='APT::Solver "aspcud"'
--aptopt='APT::Solver::aspcud::Preferences "-count(solution,APT-Release:=/a=experimental/),-removed,-changed,-new"'
=item B<--keyring>=I<file>|I<directory>
A shorthand for using C<--aptopt='Dir::Etc::Trusted "file"'> or
C<-aptopt='Dir::Etc::TrustedParts "directory"'> when passing a file or
directory to the B<--keyring> option, respectively. B<mmdebstrap> will add the
right keyring for the given I<SUITE> if it knows about the distribution and if
the keyring is installed in a path known by B<mmdebstrap>, usually
F</usr/share/keyrings>. If B<mmdebstrap> does not know or cannot find the
right keyring for the given I<SUITE> it will only know about the keys that apt
on the host system knows about. If you want to prevent B<mmdebstrap> from
choosing the right keyring for you for known values of I<SUITE>, choose an
arbitrary value for I<SUITE> and specify the right apt line manually.
=item B<--dpkgopt>=I<option>|I<file>
Pass arbitrary I<option>s to dpkg. Will be added to

Loading…
Cancel
Save