fix: iso.py — squashfs inside iso_dir, GRUB/EFI before squash, dnf5 path, live/ structure
This commit is contained in:
+46
-46
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user