[elbe-devel] [PATCH 1/2] rfs: Fix missing debootstrap keyring

Olivier Dion dion at linutronix.de
Tue Aug 18 21:10:55 CEST 2020


elbe-keyring.gpg is not saved into the binary cdrom anymore.  Thus,
import the public key repo.pub from the cdrom and export it as a
keyring into the project directory as elbe-keyring.gpg.  Use this
keyring for debootstrap.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/rfs.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index 76a6485f..bebcfc0c 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -234,8 +234,8 @@ class BuildEnv (object):
                 strapcmd, arch, suite, self.rfs.path, primary_mirror)
         else:
             if self.xml.has("project/mirror/cdrom"):
-                keyring = ' --keyring="%s/targetrepo/elbe-keyring.gpg"' % (
-                    self.rfs.fname("cdrom"))
+                prj_dir = os.path.join(self.rfs.path, "..")
+                keyring = ' --keyring="%s"' % os.path.join(prj_dir, "elbe-keyring.gpg")
             else:
                 keyring = ''
 
@@ -244,6 +244,20 @@ class BuildEnv (object):
 
         try:
             self.cdrom_mount()
+
+            if self.xml.has("project/mirror/cdrom") and not self.xml.has("project/noauth"):
+
+                import_keyring = os.path.join(prj_dir, "elbe-keyring")
+                export_keyring = import_keyring + ".gpg"
+                key            = "".join(self.rfs.cat_file("cdrom/targetrepo/repo.pub")).encode("ascii")
+
+                do("gpg --no-options --no-default-keyring --keyring %s --import" % import_keyring,
+                   stdin=key,
+                   env_add={"GNUPGHOME": "/var/cache/elbe"})
+
+                do("gpg --no-options --no-default-keyring --keyring %s --export --output %s" %
+                   (import_keyring, export_keyring))
+
             do(cmd)
 
             ui = "/usr/share/elbe/qemu-elbe/" + self.xml.defs["userinterpr"]
-- 
2.28.0



More information about the elbe-devel mailing list