public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH 2/2] isar-bootstrap: Do not let gpg-agent to stay running
Date: Fri,  3 Sep 2021 19:31:05 +0300	[thread overview]
Message-ID: <20210903163105.54003-3-amikan@ilbers.de> (raw)
In-Reply-To: <20210903163105.54003-1-amikan@ilbers.de>

If running gpg-agent as a daemon we make it to run apt-key as a child
of gpg-agent. After the finish of apt-key parent gpg-agent will be also
finished in that mode.
This will allow us not to control start-stop of gpg-agent (which was
actually broken before this commit) and get rid of any possible issues
caused by left gpg-agent processes.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index e87c091..5f87f10 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -335,20 +335,18 @@ do_bootstrap() {
             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 \
+            chroot "${ROOTFSDIR}" /usr/bin/gpg-agent --daemon -- /usr/bin/apt-key \
                 --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}"
+        if [ "${@get_distro_needs_gpg_support(d)}" = "gnupg" -a -d "${ROOTFSDIR}${MY_GPGHOME}" ]; then
+            rm -rf "${ROOTFSDIR}${MY_GPGHOME}"
         fi
 
         if [ "${@get_distro_suite(d)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then
-- 
2.25.1


  parent reply	other threads:[~2021-09-03 16:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 16:31 [PATCH 0/2] Fix gpg-agent management Anton Mikanovich
2021-09-03 16:31 ` [PATCH 1/2] isar-bootstrap: Fix GPG need check function Anton Mikanovich
2021-09-03 16:31 ` Anton Mikanovich [this message]
2021-09-03 17:30   ` [PATCH 2/2] isar-bootstrap: Do not let gpg-agent to stay running Henning Schild
2021-09-06  9:07     ` Anton Mikanovich
2021-09-06  9:35       ` Henning Schild

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=20210903163105.54003-3-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --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