mirror of
https://github.com/dockur/windows.git
synced 2026-07-28 21:53:34 +07:00
Update iso-prototype.py
This commit is contained in:
@@ -507,11 +507,6 @@ def rebuild_windows_eltorito(iso, tree: Path) -> None:
|
||||
print(f" BIOS: {bios_source} ({bios_source.stat().st_size} bytes)")
|
||||
print(f" UEFI: {uefi_source} ({uefi_source.stat().st_size} bytes)")
|
||||
|
||||
# Remove the imported catalog before touching any inode referenced by it.
|
||||
# This also releases PyCdlib's incomplete hidden boot-image records.
|
||||
if getattr(iso, "eltorito_boot_catalog", None) is not None:
|
||||
iso.rm_eltorito()
|
||||
|
||||
# These private root-level records avoid depending on the source ISO's very
|
||||
# small ISO9660 tree. The original Microsoft files remain available via UDF.
|
||||
for iso_path in (bios_iso_path, uefi_iso_path):
|
||||
@@ -567,6 +562,15 @@ def build_pycdlib(args: argparse.Namespace) -> None:
|
||||
try:
|
||||
print(f"Opening source ISO: {source}")
|
||||
iso.open(str(source))
|
||||
|
||||
# PyCdlib stores directory-child indexes on imported hidden El Torito
|
||||
# records. Any file removal/addition can make those indexes stale, which
|
||||
# makes a later rm_eltorito() fail with "Invalid child index to remove".
|
||||
# Remove the imported catalog immediately, before mutating the ISO tree.
|
||||
if getattr(iso, "eltorito_boot_catalog", None) is not None:
|
||||
print("Removing imported El Torito catalog before filesystem changes...")
|
||||
iso.rm_eltorito()
|
||||
|
||||
for value in args.replace:
|
||||
logical = PurePosixPath("/") / value.lstrip("/")
|
||||
print(f"Replacing: {logical}")
|
||||
|
||||
Reference in New Issue
Block a user