Here's a breakdown of the changes I've made to your code:

This commit introduces USB writing capabilities for Linux, macOS, and an initial
proof-of-concept for Windows. It also includes the preceding work on GUI development,
Docker orchestration, and image extraction.

Key features and changes:

1.  **GUI (PyQt6):**
    *   I've created a user interface for macOS version selection, Docker interaction, image
        extraction, USB drive selection, and operational feedback.
    *   I've also made platform-specific UI adjustments for USB drive identification on Windows
        (manual disk number input).

2.  **Docker Orchestration:**
    *   I've set up the system to build and run Docker-OSX commands in a separate thread.
    *   It now streams Docker logs to the GUI.
    *   It also persists containers with unique names for file access.
    *   And finally, it manages container lifecycle (stop/remove).

3.  **Image Extraction:**
    *   This allows you to copy `mac_hdd_ng.img` (main OS) and `OpenCore.qcow2` (EFI)
        from the Docker container to the local filesystem.

4.  **USB Writing - Linux (`usb_writer_linux.py`):**
    *   I've refactored this to use file-level copy (`rsync`) for the main macOS system
        partition, correctly handling various USB sizes.
    *   It uses `qemu-img`, `parted`, `kpartx`, `apfs-fuse`, `mkfs.hfsplus`, `rsync`.
    *   I've also automated partitioning, formatting, EFI copy, and macOS system copy.

5.  **USB Writing - macOS (`usb_writer_macos.py`):**
    *   I've implemented this using `diskutil`, `hdiutil`, `qemu-img`, and `rsync`.
    *   I've also automated partitioning, formatting, EFI copy (via raw image attach and
        rsync), and macOS system copy (via raw image attach and rsync).

6.  **USB Writing - Windows (`usb_writer_windows.py`):**
    *   This is an initial implementation using `diskpart` for partitioning and EFI setup.
    *   It uses `qemu-img` for image conversion.
    *   It relies on `7z.exe` (external) for EFI file extraction from raw image and
        `robocopy` for copying EFI files to USB.
    *   **Main macOS system image writing is currently a guided manual step**,
        instructing you to use an external 'dd for Windows' utility. This
        is due to the complexity of automating raw HFS+/APFS partition writing
        safely on Windows without commercial filesystem drivers.

7.  **Cross-Platform Integration (`main_app.py`):**
    *   I now dispatch to the appropriate platform-specific
        writer module (Linux, macOS, Windows).
    *   GUI elements adapt for platform-specific needs (e.g., Windows disk ID input).
    *   All long-running operations are threaded with progress updates.

8.  **Documentation:**
    *   I've created a `README.md` file, covering overview, features, prerequisites (including
        OS-specific tools), usage instructions, known limitations (especially for
        Windows USB writing and the macOS image sizing for `dd`), and planned
        enhancements.

9.  **General Structure:**
    *   I've organized the code into `main_app.py`, `utils.py`, `constants.py`,
        `usb_writer_linux.py`, `usb_writer_macos.py`, and `usb_writer_windows.py`.

This work consolidates all development up to providing initial USB
creation capabilities across the three target platforms, with Linux and macOS
being mostly automated and Windows having a defined path with some manual
intervention required for the main system write.
This commit is contained in:
google-labs-jules[bot] 2025-06-01 22:31:58 +00:00
parent a80706a40a
commit ae5fbcaae6

Diff Content Not Available