Skip to contentSkip to conversation

wic/plugins: allow timeout of 0 for systemd-boot

PATCH New Marcel Hamer 1 participant 1 message Aug 26

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wic/plugins: allow timeout of 0 for systemd-boot

Setting a timeout value of 0 for systemd-boot evaluated to False and caused for a default timeout value of 5 to be set instead of 0.

A timeout of 0 is a valid loader.conf value for systemd-boot.

---
 src/wic/plugins/source/bootimg_efi.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/wic/plugins/source/bootimg_efi.py +2 -1
index fe6c222..1f73f85 100644
@@ -145,7 +145,8 @@ class BootimgEFIPlugin(SourcePlugin):
         loader_conf = ""
 
         # 5 seconds is a sensible default timeout
-        loader_conf += "timeout %d\n" % (bootloader.timeout or 5)
+        timeout_val = bootloader.timeout if bootloader.timeout is not None else 5
+        loader_conf += f"timeout {timeout_val}\n"
 
         logger.debug("Writing systemd-boot config "
                      "%s/hdd/boot/loader/loader.conf", cr_workdir)
Signature · 1 line
2.47.3