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

Marcel Hamer <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
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.

Signed-off-by: Marcel Hamer <[email protected]>
---
 src/wic/plugins/source/bootimg_efi.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/wic/plugins/source/bootimg_efi.py b/src/wic/plugins/source/bootimg_efi.py
index fe6c222..1f73f85 100644
--- a/src/wic/plugins/source/bootimg_efi.py
+++ b/src/wic/plugins/source/bootimg_efi.py
@@ -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)
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.