forked from Mirror/pmbootstrap
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
This commit is contained in:
parent
ba56809dc3
commit
ae0d162d31
1 changed files with 7 additions and 4 deletions
|
@ -91,6 +91,7 @@ def frontend(args: PmbArgs) -> None:
|
||||||
context = get_context()
|
context = get_context()
|
||||||
chroot = Chroot.rootfs(context.config.device)
|
chroot = Chroot.rootfs(context.config.device)
|
||||||
flavor = pmb.chroot.other.kernel_flavor_installed(chroot)
|
flavor = pmb.chroot.other.kernel_flavor_installed(chroot)
|
||||||
|
deviceinfo = pmb.parse.deviceinfo()
|
||||||
|
|
||||||
# Handle initfs actions
|
# Handle initfs actions
|
||||||
action = args.action_initfs
|
action = args.action_initfs
|
||||||
|
@ -99,13 +100,15 @@ def frontend(args: PmbArgs) -> None:
|
||||||
elif action == "extract":
|
elif action == "extract":
|
||||||
dir = extract(flavor, chroot)
|
dir = extract(flavor, chroot)
|
||||||
logging.info(f"Successfully extracted initramfs to: {dir}")
|
logging.info(f"Successfully extracted initramfs to: {dir}")
|
||||||
dir_extra = extract(flavor, chroot, True)
|
if deviceinfo.create_initfs_extra:
|
||||||
logging.info(f"Successfully extracted initramfs-extra to: {dir_extra}")
|
dir_extra = extract(flavor, chroot, True)
|
||||||
|
logging.info(f"Successfully extracted initramfs-extra to: {dir_extra}")
|
||||||
elif action == "ls":
|
elif action == "ls":
|
||||||
logging.info("*** initramfs ***")
|
logging.info("*** initramfs ***")
|
||||||
ls(flavor, chroot)
|
ls(flavor, chroot)
|
||||||
logging.info("*** initramfs-extra ***")
|
if deviceinfo.create_initfs_extra:
|
||||||
ls(flavor, chroot, True)
|
logging.info("*** initramfs-extra ***")
|
||||||
|
ls(flavor, chroot, True)
|
||||||
|
|
||||||
# Handle hook actions
|
# Handle hook actions
|
||||||
elif action == "hook_ls":
|
elif action == "hook_ls":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue