From d929f48aa23ab8ad1246ae67b294e468644a1162 Mon Sep 17 00:00:00 2001 From: Alexey Min Date: Mon, 13 Sep 2021 14:52:12 +0300 Subject: [PATCH] pmb.chroot.initfs: adapt to new mkinitfs Follow-up to 09794ef83206af8aa558b8510578167fe4d85e1c - initfs file does not have flavor now, too. Without this 'pmbootstrap initfs extract' fails with: (rootfs_samsung-klte) % cp /boot/initramfs-postmarketos-qcom-msm8974 /tmp/initfs-extracted/_initfs.gz cp: cannot stat '/boot/initramfs-postmarketos-qcom-msm8974': No such file or directory --- pmb/chroot/initfs.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pmb/chroot/initfs.py b/pmb/chroot/initfs.py index 181d08f1..b68d21c7 100644 --- a/pmb/chroot/initfs.py +++ b/pmb/chroot/initfs.py @@ -5,6 +5,7 @@ import logging import pmb.chroot.initfs_hooks import pmb.chroot.other import pmb.chroot.apk +import pmb.config.pmaports import pmb.helpers.cli @@ -35,9 +36,16 @@ def extract(args, flavor, suffix, extra=False): """ # Extraction folder inside = "/tmp/initfs-extracted" + + pmaports_cfg = pmb.config.pmaports.read_config(args) + if pmaports_cfg.get("supported_mkinitfs_without_flavors", False): + initfs_file = "/boot/initramfs" + else: + initfs_file = f"/boot/initramfs-${flavor}" if extra: inside = "/tmp/initfs-extra-extracted" - flavor += "-extra" + initfs_file += "-extra" + outside = f"{args.work}/chroot_{suffix}{inside}" if os.path.exists(outside): if not pmb.helpers.cli.confirm(args, f"Extraction folder {outside}" @@ -55,7 +63,7 @@ def extract(args, flavor, suffix, extra=False): # Extract commands = [["mkdir", "-p", inside], - ["cp", f"/boot/initramfs-{flavor}", f"{inside}/_initfs.gz"], + ["cp", initfs_file, f"{inside}/_initfs.gz"], ["gzip", "-d", f"{inside}/_initfs.gz"], ["cat", "/tmp/_extract.sh"], # for the log ["sh", "/tmp/_extract.sh"],