[elbe-devel] [PATCH 5/6] init: set GPGHOME directory when generating elbe-keyring.gpg

Torben Hohn torben.hohn at linutronix.de
Tue Oct 1 21:12:19 CEST 2019


when ~/.gnupg does not exist, gnupg will refuse to work:

--------------------------------------------------------------------
18:53:50  INFO:root:gpg --no-options --no-default-keyring --keyring /initvm/image/.elbe-in/elbe-keyring --import
18:53:50  gpg: Fatal: /home/elbe/.gnupg: directory does not exist!
--------------------------------------------------------------------

the result is, that keys from the xml file are not added to the installer
keyring, and several packages can not be installed, when the key differs
from the default elbe key, which is also added via the system keyrings.

While touching these lines also make sure, they are not longer than 80.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/commands/init.py | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index 6b463b4cb..3b0c32d45 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -231,12 +231,23 @@ def run_command(argv):
         keys = []
         for key in xml.all(".//initvm/mirror/url-list/url/raw-key"):
             keys.append(key.et.text)
+
         import_keyring = os.path.join(out_path, "elbe-keyring")
-        do('gpg --no-options --no-default-keyring --keyring %s --import' % import_keyring,
-                    stdin="".join(keys), allow_fail=True)
+
+        do('gpg --no-options \
+                --no-default-keyring \
+                --keyring %s --import' % import_keyring,
+           stdin="".join(keys),
+           allow_fail=True,
+           env_add={'GNUPGHOME': out_path})
+
         export_keyring = import_keyring + ".gpg"
-        do('gpg --no-options --no-default-keyring --keyring %s --export --output %s' % (import_keyring,
-                                                                                    export_keyring))
+
+        do('gpg --no-options \
+                --no-default-keyring \
+                --keyring %s \
+                --export \
+                --output %s' % (import_keyring, export_keyring))
 
     if opt.devel:
         out_real = os.path.realpath(out_path)
-- 
2.20.1




More information about the elbe-devel mailing list