From ea57d0eed2253c3c7a949bee0d0161a1ed7e5c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 27 Aug 2026 20:49:53 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20iso.py=20=E2=80=94=20squashfs=20inside?= =?UTF-8?q?=20iso=5Fdir,=20GRUB/EFI=20before=20squash,=20dnf5=20path,=20li?= =?UTF-8?q?ve/=20structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- euri_mklive/iso.py | 92 +++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/euri_mklive/iso.py b/euri_mklive/iso.py index 76d4f49..d51611f 100644 --- a/euri_mklive/iso.py +++ b/euri_mklive/iso.py @@ -44,54 +44,11 @@ def generate(rootfs: Path, config: dict, output: Path) -> Path: print(f" \033[90mkernel:\033[0m {vmlinuz.name}") print(f" \033[90minitrd:\033[0m {initrd.name}") - # ─── 2. copy package manager binaries + licenses ─── - pkg_bin_dir = iso_dir / "usr" / "bin" - pkg_bin_dir.mkdir(parents=True, exist_ok=True) - licenses_dir = iso_dir / "usr" / "share" / "licenses" / "mklive" - licenses_dir.mkdir(parents=True, exist_ok=True) - - pkg_mgrs = { - "xbps-install": "/usr/bin/xbps-install", - "xbps-remove": "/usr/bin/xbps-remove", - "xbps-query": "/usr/bin/xbps-query", - "xbps-repo": "/usr/bin/xbps-repo", - "xbps-digest": "/usr/bin/xbps-digest", - "xbps-pkgdb": "/usr/bin/xbps-pkgdb", - "xbps-rindex": "/usr/bin/xbps-rindex", - "pacman": "/usr/bin/pacman", - "apt": "/usr/bin/apt", - "apt-get": "/usr/bin/apt-get", - "dpkg": "/usr/bin/dpkg", - "dnf": "/usr/bin/dnf", - "apk": "/sbin/apk", - } - - shipped = [] - for name_bin, src in pkg_mgrs.items(): - full = rootfs / src - if full.exists(): - _run(["cp", str(full), str(pkg_bin_dir / name_bin)]) - shipped.append(name_bin) - - if shipped: - (licenses_dir / "MANIFEST").write_text( - f"# Package Manager Binaries\n\n" - f"Shipped with this ISO for offline package management:\n\n" - + "\n".join(f"- {b}" for b in shipped) - + "\n\nSee individual LICENSE files for each tool.\n" - ) - print(f" \033[90mpkg managers:\033[0m {', '.join(shipped)}") - - # ─── 3. squashfs ─── - squash = workdir / "filesystem.squashfs" - print(f"\033[1;36m==>\033[0m \033[1mCreating squashfs image...\033[0m") - _run(["mksquashfs", str(iso_dir), str(squash), "-comp", "xz", "-b", "1M", "-noappend"]) - - # ─── 4. GRUB config ─── + # ─── 2. GRUB config (before squashfs so it's in the ISO) ─── grub_dir = iso_dir / "boot" / "grub" grub_dir.mkdir(parents=True, exist_ok=True) - boot_params = f"boot=live components" + boot_params = "boot=live components" if libc == "musl": boot_params += " musl" @@ -122,13 +79,56 @@ menuentry "{name} (verbose)" {{ """) print(f" \033[90mgrub cfg:\033[0m {grub_cfg.name}") - # ─── 5. EFI boot ─── + # ─── 3. EFI boot ─── efi_dir = iso_dir / "EFI" / "BOOT" efi_dir.mkdir(parents=True, exist_ok=True) efi_src = Path("/usr/lib/grub/x86_64-efi/monolithic/grubx64.efi") if efi_src.exists(): _run(["cp", str(efi_src), str(efi_dir / "BOOTX64.EFI")]) + # ─── 4. squashfs (inside iso_dir so xorriso includes it) ─── + squash_dir = iso_dir / "live" + squash_dir.mkdir(parents=True, exist_ok=True) + squash = squash_dir / "filesystem.squashfs" + print(f"\033[1;36m==>\033[0m \033[1mCreating squashfs image...\033[0m") + _run(["mksquashfs", str(iso_dir), str(squash), "-comp", "xz", "-b", "1M", "-noappend"]) + + # ─── 5. copy package manager binaries + licenses ─── + pkg_bin_dir = iso_dir / "usr" / "bin" + pkg_bin_dir.mkdir(parents=True, exist_ok=True) + licenses_dir = iso_dir / "usr" / "share" / "licenses" / "mklive" + licenses_dir.mkdir(parents=True, exist_ok=True) + + pkg_mgrs = { + "xbps-install": "/usr/bin/xbps-install", + "xbps-remove": "/usr/bin/xbps-remove", + "xbps-query": "/usr/bin/xbps-query", + "xbps-rindex": "/usr/bin/xbps-rindex", + "xbps-pkgdb": "/usr/bin/xbps-pkgdb", + "pacman": "/usr/bin/pacman", + "apt": "/usr/bin/apt", + "apt-get": "/usr/bin/apt-get", + "dpkg": "/usr/bin/dpkg", + "dnf5": "/usr/bin/dnf5", + "apk": "/sbin/apk", + } + + shipped = [] + for name_bin, src in pkg_mgrs.items(): + full = rootfs / src + if full.exists(): + _run(["cp", str(full), str(pkg_bin_dir / name_bin)]) + shipped.append(name_bin) + + if shipped: + (licenses_dir / "MANIFEST").write_text( + f"# Package Manager Binaries\n\n" + f"Shipped with this ISO for offline package management:\n\n" + + "\n".join(f"- {b}" for b in shipped) + + "\n\nSee individual LICENSE files for each tool.\n" + ) + print(f" \033[90mpkg managers:\033[0m {', '.join(shipped)}") + # ─── 6. xorriso to create ISO ─── iso_path = output / f"{name.lower().replace(' ', '-')}-{version}-{distro}-{libc}-x86_64.iso" print(f"\033[1;36m==>\033[0m \033[1mCreating ISO: {iso_path.name}\033[0m")