[elbe-devel] [PATCH 2/3] commands init: Create initrd-tree
Torben Hohn
torben.hohn at linutronix.de
Mon Jun 15 11:57:14 CEST 2020
On Mon, Jun 08, 2020 at 11:18:30PM -0400, Olivier Dion wrote:
> 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.
this is not nice to review.
Please fold it with Patch 1
>
> 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"),
please find out, why we need 2 copies of apt.conf
seems wrong.
> + ("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"))
hmm... the keyrings could have been created in the right place
already.
But lets not clutter the if cdrom logic, with the dst path.
> +
> + for _cfg in glob.glob(os.path.join(out_path, "*.cfg")):
> + to_cpy.append((_cfg, ""))
there seems to be only preseed.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)
I would prefer to have elbepack.filesystem.Filesystem
used. it already defines mkdir_p() and glob()
> --
> 2.27.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
More information about the elbe-devel
mailing list