From e650b9b0ff24240197cf0a6f26642fa660e2a110 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Wed, 28 Sep 2022 23:13:35 -0400 Subject: New upstream version 27. --- pacstrap.in | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'pacstrap.in') diff --git a/pacstrap.in b/pacstrap.in index b1cfb09..0e25ef8 100644 --- a/pacstrap.in +++ b/pacstrap.in @@ -14,6 +14,7 @@ m4_include(common) hostcache=0 copykeyring=1 +initkeyring=0 copymirrorlist=1 pacmode=-Sy setup=chroot_setup @@ -28,6 +29,7 @@ usage: ${0##*/} [options] root [packages...] -c Use the package cache on the host, rather than the target -G Avoid copying the host's pacman keyring to the target -i Prompt for package confirmation when needed (run interactively) + -K Initialize an empty pacman keyring in the target (implies '-G') -M Avoid copying the host's mirrorlist to the target -N Run in unshare mode as a regular user -U Use pacman -U to install packages @@ -45,7 +47,7 @@ if [[ -z $1 || $1 = @(-h|--help) ]]; then exit $(( $# ? 0 : 1 )) fi -while getopts ':C:cdGiMNU' flag; do +while getopts ':C:cdGiKMNU' flag; do case $flag in C) pacman_config=$OPTARG @@ -62,6 +64,9 @@ while getopts ':C:cdGiMNU' flag; do G) copykeyring=0 ;; + K) + initkeyring=1 + ;; M) copymirrorlist=0 ;; @@ -112,9 +117,11 @@ pacstrap() { # mount API filesystems $setup "$newroot" || die "failed to setup chroot %s" "$newroot" - if (( copykeyring )); then - # if there's a keyring on the host, copy it into the new root, unless it exists already - if [[ -d /etc/pacman.d/gnupg && ! -d $newroot/etc/pacman.d/gnupg ]]; then + if [[ ! -d $newroot/etc/pacman.d/gnupg ]]; then + if (( initkeyring )); then + pacman-key --gpgdir "$newroot"/etc/pacman.d/gnupg --init + elif (( copykeyring )) && [[ -d /etc/pacman.d/gnupg ]]; then + # if there's a keyring on the host, copy it into the new root cp -a --no-preserve=ownership /etc/pacman.d/gnupg "$newroot/etc/pacman.d/" fi fi -- cgit v1.2.3