[elbe-devel] [PATCH 2/3] commands init: Create initrd-tree

Olivier Dion dion at linutronix.de
Tue Jun 9 05:18:30 CEST 2020


This tree used to be generated in the initvm Makefile.  The logic is
moved here so it's easier to change.

One should add tuples of the form (SRC, DST).  Where SRC is the file
in '.elbe-in' that is copied into '.elbe-in/initrd-tree'.

In other words: .elbe-in/SRC -> .elbe-in/initrd-tree/DST.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/commands/init.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index a97d45df..8dec02f0 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -7,6 +7,7 @@
 
 from __future__ import print_function
 
+import glob
 import os
 import sys
 import shutil
@@ -272,3 +273,29 @@ def run_command(argv):
             system('tar cfj "%s" %s -C "%s" .' % (tar_fname,
                                                   ignore,
                                                   elbe_dir))
+
+        to_cpy = [("apt.conf", ""),
+                  ("apt.conf", "etc/apt"),
+                  ("init-elbe.sh", ""),
+                  ("source.xml", ""),
+                  ("initrd-cdrom.gz", ""),
+                  ("vmlinuz", "")]
+
+        for gpg in glob.glob(os.path.join(out_path, "*.gpg")):
+            to_cpy.append((gpg, "usr/share/keyrings"))
+
+        for _cfg in glob.glob(os.path.join(out_path, "*.cfg")):
+            to_cpy.append((_cfg, ""))
+
+        if opt.devel:
+            to_cpy.append(("elbe-devel.tar.bz2", ""))
+
+        for src, dst in to_cpy:
+            src = os.path.join(out_path, src)
+            dst = os.path.join(out_path, "initrd-tree", dst)
+            print("Including %s in initrd at %s" % (src, dst))
+            try:
+                os.makedirs(dst)
+            except FileExistsError:
+                pass
+            shutil.copy(src, dst)
-- 
2.27.0




More information about the elbe-devel mailing list