From ae0d162d31062f0d83ff7e8b9eb6ce74e88b2090 Mon Sep 17 00:00:00 2001 From: Anri Dellal Date: Thu, 10 Jul 2025 21:20:54 +0300 Subject: [PATCH] pmb.chroot.initfs: Fix initfs commands Fix "initfs ls" and "initfs extract" crashing if initramfs-extra is missing. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2643 --- pmb/chroot/initfs.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pmb/chroot/initfs.py b/pmb/chroot/initfs.py index 2ac726f3..15ae8bb0 100644 --- a/pmb/chroot/initfs.py +++ b/pmb/chroot/initfs.py @@ -91,6 +91,7 @@ def frontend(args: PmbArgs) -> None: context = get_context() chroot = Chroot.rootfs(context.config.device) flavor = pmb.chroot.other.kernel_flavor_installed(chroot) + deviceinfo = pmb.parse.deviceinfo() # Handle initfs actions action = args.action_initfs @@ -99,13 +100,15 @@ def frontend(args: PmbArgs) -> None: elif action == "extract": dir = extract(flavor, chroot) logging.info(f"Successfully extracted initramfs to: {dir}") - dir_extra = extract(flavor, chroot, True) - logging.info(f"Successfully extracted initramfs-extra to: {dir_extra}") + if deviceinfo.create_initfs_extra: + dir_extra = extract(flavor, chroot, True) + logging.info(f"Successfully extracted initramfs-extra to: {dir_extra}") elif action == "ls": logging.info("*** initramfs ***") ls(flavor, chroot) - logging.info("*** initramfs-extra ***") - ls(flavor, chroot, True) + if deviceinfo.create_initfs_extra: + logging.info("*** initramfs-extra ***") + ls(flavor, chroot, True) # Handle hook actions elif action == "hook_ls":