]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
systemd-bootconf: do not modify build directory in do_install
authorNora Schiffer <nora.schiffer@ew.tq-group.com>
Wed, 18 Mar 2026 15:24:36 +0000 (16:24 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Mar 2026 16:47:14 +0000 (16:47 +0000)
do_install should only modify ${D}, otherwise rerunning the task will
have inconsistent results. In the case of systemd-bootconf, a second run
of do_install without rerunning do_configure (for example after modifying
it in a bbappend) fails altogether, as loader.conf would be missing.

Rather than fixing this up by deleting loader.conf from ${D} instead of
${S} after copying *.conf, clean up systemd-boot-cfg.bbclass not to
store loader.conf at the same location as the individual entries in the
first place, so they can be copied separately. While we're at it, also
change the recipe to make use of the variables defined by the class.

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/systemd-boot-cfg.bbclass
meta/recipes-core/systemd/systemd-bootconf_1.00.bb

index 12da41ebad7ebf1a71099f35bc5082d7d2ca4c31..66403ff5524665d8b37fa0fb5bf0a4f97923eb8d 100644 (file)
@@ -5,6 +5,7 @@
 #
 
 SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
+SYSTEMD_BOOT_ENTRIES_DIR ?= "${S}/entries"
 SYSTEMD_BOOT_ENTRIES ?= ""
 SYSTEMD_BOOT_TIMEOUT ?= "10"
 
@@ -15,7 +16,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 inherit fs-uuid
 
 python build_efi_cfg() {
-    s = d.getVar("S")
     labels = d.getVar('LABELS')
     if not labels:
         bb.debug(1, "LABELS not defined, nothing to do")
@@ -43,12 +43,14 @@ python build_efi_cfg() {
         cfgfile.write('timeout 10\n')
     cfgfile.close()
 
+    entries_dir = d.getVar('SYSTEMD_BOOT_ENTRIES_DIR')
+    if not os.path.exists(entries_dir):
+        os.makedirs(entries_dir)
+
     for label in labels.split():
         localdata = d.createCopy()
 
-        entryfile = "%s/%s.conf" % (s, label)
-        if not os.path.exists(s):
-            os.makedirs(s)
+        entryfile = "%s/%s.conf" % (entries_dir, label)
         d.appendVar("SYSTEMD_BOOT_ENTRIES", " " + entryfile)
         try:
             entrycfg = open(entryfile, "w")
index 5efac3e4106c5c056ac72529d4c44d0674801695..53b634ddc2faa240e437ac14623a418b53dd1ebb 100644 (file)
@@ -24,9 +24,8 @@ do_install() {
        install -d ${D}/boot
        install -d ${D}/boot/loader
        install -d ${D}/boot/loader/entries
-       install loader.conf ${D}/boot/loader/
-       rm loader.conf
-       install *.conf ${D}/boot/loader/entries/
+       install ${SYSTEMD_BOOT_CFG} ${D}/boot/loader/
+       install ${SYSTEMD_BOOT_ENTRIES_DIR}/*.conf ${D}/boot/loader/entries/
 }
 
 FILES:${PN} = "/boot/loader/* /boot/loader/entries/*"