From patchwork Fri Dec 2 16:21:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masato TOYOSHIMA X-Patchwork-Id: 2093 Return-Path: Delivered-To: patchwork@archlinux.org Received: from mail.archlinux.org [2a01:4f9:c010:3052::1] by patchwork.archlinux.org with IMAP (fetchmail-6.4.34) for (single-drop); Fri, 02 Dec 2022 16:21:23 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id 6McCFgMmimPqGw0AK+/4rw (envelope-from ) for ; Fri, 02 Dec 2022 16:21:23 +0000 Received: from lists.archlinux.org (lists.archlinux.org [95.217.236.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.archlinux.org (Postfix) with ESMTPS id C1EB61750D5E; Fri, 2 Dec 2022 16:21:21 +0000 (UTC) Authentication-Results: mail.archlinux.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=cwdDcpHo; spf=pass (mail.archlinux.org: domain of pacman-dev-bounces@lists.archlinux.org designates 95.217.236.249 as permitted sender) smtp.mailfrom=pacman-dev-bounces@lists.archlinux.org; dmarc=pass (policy=none) header.from=gmail.com Received: from lists.archlinux.org (localhost [IPv6:::1]) by lists.archlinux.org (Postfix) with ESMTP id 523096BB239; Fri, 2 Dec 2022 16:21:19 +0000 (UTC) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lists.archlinux.org (Postfix) with ESMTPS id 63AD86BB22D for ; Fri, 2 Dec 2022 16:21:14 +0000 (UTC) Received: by mail-pj1-x102d.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so5594247pjm.2 for ; Fri, 02 Dec 2022 08:21:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:from:content-language:to:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=2yKBvCdjYSUmqdDNoVswWcv3rC1Aa8HPEzvYTaZadZk=; b=cwdDcpHoHd2f1SvW7JpLGi38/mY6Dh+ZJPN0Rdf6Uh+1KVptcTYL/ZL6fMR3rBJm8O rhBPnZtGAXQewAPeMpBPrTeRIELZlMz95gZq4e3U6yPmo/Oj24npjHDKVVhI3ZckjSEw L2fSLzIKuM7u/bB6VrCy7GQJZwKT3/PwsukzO2dkXlvCdJE2SKBaYofRR7vYJqXkag0D bPjpCSPeNoD24yNDwEy5ul3MuLaoSx/ng7jAsODFlj+ZtxSSOpbE4hjP59549dWyyalA 9y1oua3/Wv4IoOTbf8nwJ97SVAgmyfDr+4xw0kU0xGzd73IsJyLofUWopA6NOAZHtIB1 H3hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=subject:from:content-language:to:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2yKBvCdjYSUmqdDNoVswWcv3rC1Aa8HPEzvYTaZadZk=; b=Su58oOKysSdozvAXNSh3xzpJWF0AMoGvctRwmmZlVNq67Ox7hhtNUgri9Tiz38JRwy E23cUmg/bOAwiPdPcx1gLFUap7JIwednOrsX/PXscJJDdVatyfMIc+J3/HHRPWBxOYGj KjXHc1qSZKtGf3/paQ/gCUNwaxu+MvafquaGUbkPTepzyoTUHRd141AhGeYq5mBkgHok iWtrGXe+VxKW2HQQHNmnF5085Qec5g93hLl/V2kWep2Nxq5QtN3sdvXyao1bKEIejXLh YmCg/EP6YzBA859DtvppW8QYwIO5DR6lREr0DHAOGqwTpVOi25oXfZJj5Eo0p/SDfIW0 akjQ== X-Gm-Message-State: ANoB5pnGJLSb7Qj6t7Drahyqwe2s0Fn8PJdncX6A/iPVO/qmHlpK5RQp Bs+E9DuHvtcdBO30711avILRLe1G7rQjVA== X-Google-Smtp-Source: AA0mqf7+e73xVZNU8ktk8RnhPphWeBfWpJIdN4yS3Tw+BbdSu4n11wv/3UHink2v62NK6S7Oq0CBHw== X-Received: by 2002:a17:902:8d93:b0:17f:8042:7223 with SMTP id v19-20020a1709028d9300b0017f80427223mr58416254plo.38.1669998070894; Fri, 02 Dec 2022 08:21:10 -0800 (PST) Received: from ?IPV6:2409:250:60e0:3d00:1fd6:d027:88a5:21c6? ([2409:250:60e0:3d00:1fd6:d027:88a5:21c6]) by smtp.gmail.com with ESMTPSA id b4-20020a170903228400b00188fc6766d6sm5805074plh.219.2022.12.02.08.21.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Dec 2022 08:21:10 -0800 (PST) Message-ID: <0800a1d9-cfa9-e133-7162-04ec9606afbf@gmail.com> Date: Sat, 3 Dec 2022 01:21:03 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 To: pacman-dev@lists.archlinux.org Content-Language: en-US From: Masato TOYOSHIMA Subject: [pacman-key] Support for new gpg kbx files in imports. Message-ID-Hash: BBHVCVAKVOPV2JEUESKEYH7JEPZHKJLH X-Message-ID-Hash: BBHVCVAKVOPV2JEUESKEYH7JEPZHKJLH X-MailFrom: phoepsilonix@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.7 Precedence: list List-Id: Discussion list for pacman development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Rspamd-Server: mail.archlinux.org X-Rspamd-Queue-Id: C1EB61750D5E X-Spamd-Result: default: False [-2.81 / 15.00]; SIGNED_PGP(-2.00)[]; MIME_BASE64_TEXT_BOGUS(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain,text/x-patch]; MAILLIST(-0.20)[mailman]; RCVD_IN_DNSWL_MED(-0.20)[95.217.236.249:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip4:95.217.236.249:c]; MIME_UNKNOWN(0.10)[application/pgp-keys]; MIME_BASE64_TEXT(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[pacman-dev@lists.archlinux.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::102d:received]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; FROM_NEQ_ENVFROM(0.00)[phoepsilonix@gmail.com,pacman-dev-bounces@lists.archlinux.org]; TO_DN_NONE(0.00)[]; HAS_ATTACHMENT(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+,4:+,5:~,6:~]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:24940, ipnet:95.217.0.0/16, country:DE]; NEURAL_HAM(-0.00)[-1.000]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Action: no action Hello. Support for new gpg kbx files in imports. Allow Import for both types pubring.gpg and pubring.kbx. ``` ++ ret=1 ++ fi ++ fi + fi + done + if (( ret )); then ``` diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index 913f2c3..5910b47 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -453,14 +453,21 @@ import() { local importdir local ret=0 for importdir in "$@"; do + if [[ ! -f "${importdir}/pubring.gpg" && ! -f "${importdir}/pubring.kbx" ]]; then + error "$(gettext "Both file %s does not exist and could not be imported.")" "${importdir}/pubring.gpg and ${importdir}/pubring.kbx" + ret=1 if [[ -f "${importdir}/pubring.gpg" ]]; then if ! "${GPG_PACMAN[@]}" --quiet --batch --import "${importdir}/pubring.gpg" ; then error "$(gettext "%s could not be imported.")" "${importdir}/pubring.gpg" ret=1 fi - else - error "$(gettext "File %s does not exist and could not be imported.")" "${importdir}/pubring.gpg" - ret=1 + fi + if [[ -f "${importdir}/pubring.kbx" ]]; then + if ! "${GPG_PACMAN[@]}" --quiet --batch --homedir "${importdir}" --keyring pubring.kbx --export | "${GPG_PACMAN[@]}" --import - ; then + error "$(gettext "%s could not be imported.")" "${importdir}/pubring.kbx" + ret=1 + fi + fi fi done if (( ret )); then