From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Yuri Adamov <yadamov@ilbers.de>, Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v3] isar-bootstrap: Run gpg-agent before starting apt-key
Date: Fri, 22 Jan 2021 20:09:03 +0300 [thread overview]
Message-ID: <20210122170903.28134-1-amikan@ilbers.de> (raw)
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>
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
Changes since v2:
- Restored conditional gnupg include.
- Made gpg-agent run in gpg enabled builds only.
Changes since v1:
- Removed unnecessary sleeping.
- Removed -9 in kill.
- Commented unconditionally gnupg package append.
- Removed unused OVERRIDES_append and get_distro_needs_gpg_support().
---
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 8f5f727..0edefc5 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -309,14 +309,25 @@ 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"
+ if [ "${@get_distro_needs_gpg_support(d)}" = "gnupg" ]; then
+ MY_GPGHOME="$(chroot "${ROOTFSDIR}" mktemp -d /tmp/gpghomeXXXXXXXXXX)"
+ echo "Created temporary directory ${MY_GPGHOME} for gpg-agent"
+ export GNUPGHOME="${MY_GPGHOME}"
+ chroot "${ROOTFSDIR}" gpg-agent --daemon
+ APT_KEY_APPEND="--homedir ${MY_GPGHOME}"
+ fi
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} ${APT_KEY_APPEND} add "/tmp/$kfn"
rm "${ROOTFSDIR}/tmp/$kfn"
done
+ if [ -d "${MY_GPGHOME}" ]; then
+ echo "Killing gpg-agent for ${MY_GPGHOME}"
+ chroot "${ROOTFSDIR}" gpgconf --kill gpg-agent && /bin/rm -rf "${MY_GPGHOME}"
+ fi
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 reply other threads:[~2021-01-22 17:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-22 17:09 Anton Mikanovich [this message]
2021-01-25 12:31 ` Jan Kiszka
2021-02-05 14:59 ` 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=20210122170903.28134-1-amikan@ilbers.de \
--to=amikan@ilbers.de \
--cc=isar-users@googlegroups.com \
--cc=yadamov@ilbers.de \
/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