From: Baurzhan Ismagulov <ibr@radix50.net>
To: isar-users@googlegroups.com
Subject: [PATCH v1] isar-bootstrap: Run gpg-agent before starting apt-key
Date: Wed, 16 Dec 2020 16:53:30 +0100 [thread overview]
Message-ID: <20201216155330.28348-1-ibr@radix50.net> (raw)
In-Reply-To: <72ce3a90-0772-c8a4-f233-1b887c636a9d@siemens.com>
From: Yuri Adamov <yadamov@ilbers.de>
Building rpi-stretch natively (under qemu) sometimes fails with:
gpg: can't connect to the agent: IPC connect call failed
gpg starts gpg-agent and times out after 5 s. This value is hard-coded.
Besides, leaving running gpg-agent processes is not clean and prevents
unmounting of filesystems.
This patch starts and stops the agent manually.
Signed-off-by: Yuri Adamov <yadamov@ilbers.de>
---
Notes:
* Submitting WIP for preview, as cleaning up will require testing time.
* Remove sleeping.
* Remove -9 in kill.
* Maybe check if starting the agent is necessary.
* Remove OVERRIDES_append and get_distro_needs_gpg_support() if unused.
.../recipes-core/isar-bootstrap/isar-bootstrap.inc | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 4925a45d..74569e5d 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -24,7 +24,7 @@ DISTRO_BOOTSTRAP_KEYFILES = ""
THIRD_PARTY_APT_KEYFILES = ""
DEPLOY_ISAR_BOOTSTRAP ?= ""
DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales"
-DISTRO_BOOTSTRAP_BASE_PACKAGES_append_gnupg = ",gnupg"
+DISTRO_BOOTSTRAP_BASE_PACKAGES_append = ",gnupg"
DISTRO_BOOTSTRAP_BASE_PACKAGES_append_https-support = "${@https_support(d)}"
inherit deb-dl-dir
@@ -307,14 +307,24 @@ isar_bootstrap() {
mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d"
install -v -m644 "${WORKDIR}/isar-apt.conf" \
"${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf"
+ MY_GPGHOME=$(chroot "${ROOTFSDIR}" mktemp -d /tmp/gpghomeXXXXXXXXXX)
+ echo "Created temporary directory ${MY_GPGHOME} for gpg-agent"
+ chroot "${ROOTFSDIR}" gpg-agent --homedir "${MY_GPGHOME}" --daemon
find ${APT_KEYS_DIR}/ -type f | while read keyfile
do
kfn="$(basename $keyfile)"
cp $keyfile "${ROOTFSDIR}/tmp/$kfn"
chroot "${ROOTFSDIR}" /usr/bin/apt-key \
- --keyring ${THIRD_PARTY_APT_KEYRING} add "/tmp/$kfn"
+ --keyring ${THIRD_PARTY_APT_KEYRING} \
+ --homedir ${MY_GPGHOME} add "/tmp/$kfn"
rm "${ROOTFSDIR}/tmp/$kfn"
done
+ sleep 4
+ GPG_AGENT_PID=$(ps -aux | grep "gpg-agent.*${MY_GPGHOME}" | grep -v grep | awk '{print $2}')
+ echo "Killing gpg-agent with pid $GPG_AGENT_PID"
+ /bin/kill -9 ${GPG_AGENT_PID}
+ sleep 4
+ chroot "${ROOTFSDIR}" /bin/rm -rf "${MY_GPGHOME}"
if [ "${@get_distro_suite(d, True)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then
install -v -m644 "${WORKDIR}/isar-apt-fallback.conf" \
--
2.20.1
next prev parent reply other threads:[~2020-12-16 15:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 14:01 [PATCH v4 00/13] Complete backlog: SDK, assorting fixed and cleanups Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 01/13] sdk: Add support for adding self-defined sdk packages Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 02/13] sdk: Make all links in the SDK chroot relative Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 03/13] sdk: Add script to relocate SDK Jan Kiszka
2020-10-15 18:50 ` Baurzhan Ismagulov
2020-10-16 6:47 ` Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 04/13] sdk: Make shipping the isar-apt repo opt-in Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 05/13] sdk: Inject sysroot path when calling relocated toolchain Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 06/13] sdk: Update README.sdk Jan Kiszka
2020-10-16 8:18 ` [PATCH v5 " Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 07/13] isar-bootstrap: Connect to gpg-agent before adding keys Jan Kiszka
2020-11-21 7:41 ` Jan Kiszka
2020-12-14 7:03 ` Jan Kiszka
2020-12-16 11:36 ` Baurzhan Ismagulov
2020-12-16 15:53 ` Baurzhan Ismagulov [this message]
2020-12-16 16:41 ` [PATCH v1] isar-bootstrap: Run gpg-agent before starting apt-key Jan Kiszka
2021-01-18 17:30 ` Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 08/13] buildchroot-host: Drop unneeded :native for riscv64 setup Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 09/13] deb-dl-dir: Fix quoting Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 10/13] Fix dependencies on isar-apt Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 11/13] dpkg: Account for changes in mk-build-deps in bullseye Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 12/13] isar-bootstrap: Align debootstrap calls Jan Kiszka
2020-10-07 14:01 ` [PATCH v4 13/13] u-boot: Deprecate BUILD_DEPENDS in favor of DEBIAN_BUILD_DEPENDS Jan Kiszka
2020-11-05 14:23 ` [PATCH v4 00/13] Complete backlog: SDK, assorting fixed and cleanups Baurzhan Ismagulov
2020-11-26 15:40 ` Anton Mikanovich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201216155330.28348-1-ibr@radix50.net \
--to=ibr@radix50.net \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox