diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a53b347..23dd5b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,9 @@ jobs: - name: Scan clean public checkout run: python3 tools/check-public-tree.py . - name: Generate GitHub Wiki from public guides - run: python3 tools/build-wiki.py + run: | + python3 tools/build-wiki.py + python3 tools/test-package-setup-platform.py host-core: name: Host core and HTTP diff --git a/.github/workflows/package-setup.yml b/.github/workflows/package-setup.yml new file mode 100644 index 0000000..ba49304 --- /dev/null +++ b/.github/workflows/package-setup.yml @@ -0,0 +1,43 @@ +name: Package Moader Setup apps + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + package: + name: Prebuilt macOS, Linux and Windows apps + if: github.ref == 'refs/heads/main' + runs-on: macos-15 + timeout-minutes: 90 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.12' + - name: Stage only matched v4 native inputs + env: + GH_TOKEN: ${{ github.token }} + run: | + mkdir -p build/release-inputs + gh release download v4.0.0 --repo "$GITHUB_REPOSITORY" \ + --pattern 'Moader-backend-v4.0.0.zip' --dir build/release-inputs + python3 tools/stage-release-inputs.py \ + --backend-zip build/release-inputs/Moader-backend-v4.0.0.zip + - name: Package and verify five prebuilt desktop apps + run: | + python3 tools/package-release.py --output build/release-artifacts + python3 tools/package-setup-platform.py --release-dir build/release-artifacts + cd build/release-artifacts + shasum -a 256 -c SHA256SUMS.txt + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: moader-v4-release-assets + path: build/release-artifacts/* + if-no-files-found: error + compression-level: 0 + retention-days: 7 diff --git a/CHANGELOG.md b/CHANGELOG.md index cdcf6cc..75202c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## v4.0.0 — Setup and in-app updates -- Publish **Moader Setup** as a separate, self-contained ZIP with desktop launchers for macOS, Linux and Windows with WSL2. The smaller backend ZIP retains the command-line tools and matched native files. Setup guides host preparation, SD copying, connection checks and support export using the existing checked installers. +- Publish five self-contained, prebuilt **Moader Setup** app downloads for macOS, Linux and Windows with WSL2. GitHub Actions packages each OS and architecture separately. The smaller backend ZIP retains the command-line tools and matched native files. Setup guides host preparation, SD copying, connection checks and support export using the existing checked installers. - Add **Settings → Updates** to the console app for manual checks and optional checks at launch and every six hours. Updates verify both app and resident downloads before installation and can resume after interruption. - Match the Setup window to Moader's console and browser theme. Keep the pinned kaiHEN and Seedsow A/B components. The new Setup and update flows have host validation; the exact v4.0.0 release pair and desktop kit have no Switch 2 installation result. [Release notes](docs/releases/v4.0.0.md). diff --git a/README.md b/README.md index a15c638..ae0f97c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The console app opens from **hbmenu**. The resident plugin keeps the browser and | v4.0.0 download | What's inside | | --- | --- | | [Moader app and plugin](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-v4.0.0.zip) | The two files to copy to SD when you already have a compatible backend. | -| [Moader Setup](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0.zip) | Guided desktop app with its own complete backend files and runtimes. | +| [Moader Setup apps](https://github.com/H644b/Moader/releases/tag/v4.0.0) | Choose the prebuilt macOS, Linux or Windows download for your computer. Each app contains its matching backend files. | | [Moader backend kit](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-backend-v4.0.0.zip) | Smaller command-line kit with the app, plugin and backend files. | [Release notes and checksums](https://github.com/H644b/Moader/releases/tag/v4.0.0) diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md index 8aa9cb1..eaa9da6 100644 --- a/THIRD_PARTY.md +++ b/THIRD_PARTY.md @@ -8,9 +8,9 @@ Moader's original source is licensed under **GPL-2.0-only**. Upstream files keep | Component | Version or revision | Location and license | | --- | --- | --- | -| [Node.js](https://nodejs.org/download/release/v24.22.3/) | 24.22.3 | Setup ZIP only: pinned native controller executables for macOS and Linux arm64/x86_64. The upstream `LICENSE` accompanies them in `host-runtimes/node-v24.22.3/LICENSE`. Archive checksums are enforced by [`tools/package-release.py`](tools/package-release.py). | -| [uv](https://github.com/astral-sh/uv/releases/tag/0.12.16) | 0.12.16 | Setup ZIP only: pinned native helper for kit-scoped Python provisioning, with [Apache-2.0](setup/licenses/uv-LICENSE-APACHE.txt) and [MIT](setup/licenses/uv-LICENSE-MIT.txt) notices. Archive checksums are enforced by [`tools/package-release.py`](tools/package-release.py). | -| [Electron](https://github.com/electron/electron/releases/tag/v45.4.1) | 45.4.1 | Setup ZIP only: pinned desktop runtimes for macOS and Linux arm64/x86_64 and Windows x86_64. Each runtime keeps its upstream `LICENSE` and `LICENSES.chromium.html`; archive checksums are enforced by [`tools/package-release.py`](tools/package-release.py). | +| [Node.js](https://nodejs.org/download/release/v24.22.3/) | 24.22.3 | Setup app downloads only: pinned native controller executables for macOS and Linux arm64/x86_64. The upstream `LICENSE` accompanies them in `host-runtimes/node-v24.22.3/LICENSE`. Archive checksums are enforced by [`tools/package-release.py`](tools/package-release.py). | +| [uv](https://github.com/astral-sh/uv/releases/tag/0.12.16) | 0.12.16 | Setup app downloads only: pinned native helper for kit-scoped Python provisioning, with [Apache-2.0](setup/licenses/uv-LICENSE-APACHE.txt) and [MIT](setup/licenses/uv-LICENSE-MIT.txt) notices. Archive checksums are enforced by [`tools/package-release.py`](tools/package-release.py). | +| [Electron](https://github.com/electron/electron/releases/tag/v45.4.1) | 45.4.1 | Setup app downloads only: pinned desktop runtimes for macOS and Linux arm64/x86_64 and Windows x86_64. Each runtime keeps its upstream `LICENSE` and `LICENSES.chromium.html`; archive checksums are enforced by [`tools/package-release.py`](tools/package-release.py). | | [kaiHEN](https://github.com/ouncebrew/kaihen) | `e897f991524590833b82fbe8d63a3c6775fb8101` | Source in [`runtime/kaihen`](runtime/kaihen/). GPL-2.0-only with the upstream linking exception and separate permissive component notices. Moader's patch is [`software-builds/kaihen-mo.patch`](software-builds/kaihen-mo.patch). | | [kaiHEN release](https://github.com/ouncebrew/kaihen/releases/tag/20261114c) | `20261114c` | Setup downloads the qualified official base, game loader and hbmenu; the v0.2.0 kit supplies its separately matched patched RO/HEN/bootstrap. Bundled component notices are retained in [`native/third_party/licenses`](native/third_party/licenses/) and [`runtime/kaihen/release/licenses`](runtime/kaihen/release/licenses/). Archive SHA-256: `63b91e5e7c6f411aad758758e5a1a3cbe1f855b4304d87916afe5319b9dfd967`. | | [ns2jb-modloader](https://github.com/SebaaMG/ns2jb-modloader) | `63d46b27ea33a9bfeb43b497b8fb89498cf6c148` | Forked source in [`runtime/modloader`](runtime/modloader/), under its retained GPL-2.0 terms and bundled-component notices. Moader adds dynamic catalogues, lifetime ownership, receipts and closed debug snapshots. | diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index c674355..93bf329 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -2,12 +2,12 @@ Choose a download based on what is already running on your Switch. Use the app and resident plugin from the same release. -For guided installation, SD copying, connection checks and support export, download the separate, self-contained [Moader Setup ZIP](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0.zip). Extract it and open **Moader Setup.app** on macOS, **Moader Setup** on Linux, or **Moader Setup Windows/Moader Setup.exe** on Windows with WSL2. The smaller backend ZIP provides the command-line routes below. [Setup guide](SETUP_GUI.md) +For guided installation, SD copying, connection checks and support export, choose the prebuilt [Moader Setup app for your computer](SETUP_GUI.md#download). Extract it and open **Moader Setup.app** on macOS, **Moader Setup** on Linux, or **Moader Setup.exe** on Windows with WSL2. Each app contains its matching backend files. The smaller backend ZIP provides the command-line routes below. | What you need | Download | | --- | --- | | Install or update Moader on an existing compatible backend | [Moader-v4.0.0.zip](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-v4.0.0.zip) | -| Guided setup for this boot | [Moader-Setup-v4.0.0.zip](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0.zip) | +| Guided setup for this boot | [Choose your macOS, Linux or Windows app](SETUP_GUI.md#download) | | Command-line backend kit | [Moader-backend-v4.0.0.zip](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-backend-v4.0.0.zip) | ## Copy or update the console app diff --git a/docs/MAINTAINING.md b/docs/MAINTAINING.md index 240b55a..170e112 100644 --- a/docs/MAINTAINING.md +++ b/docs/MAINTAINING.md @@ -11,7 +11,7 @@ Package a clean, committed source tree with the exact binaries recorded in `conf | Public source | Audited source allowlist, tests, documentation, license notices and portable native prebuilt assets | | `Moader-v4.0.0.zip` | SD layout: `switch/Moader.nro`, `kaihen/plugins/moader.nso`, release docs/licenses/manifest | | `Moader-backend-v4.0.0.zip` | Smaller command-line host kit: public source and tools, matched Moader/kaiHEN binaries, pinned official kaiHEN archive, complete regular bundle, and `prebuilt/standalone-bootstrap/{bootstrap.bin,proof.json}`; no Setup app or desktop runtimes | -| `Moader-Setup-v4.0.0.zip` | Self-contained guided desktop kit: the backend files plus Moader Setup launchers and pinned Node/uv/Electron runtimes for supported hosts | +| `Moader-Setup-v4.0.0-{macos-arm64,macos-x64,linux-arm64,linux-x64,windows-x64}.zip` | Five prebuilt desktop apps, each with the complete matched backend and only the Node/uv/Electron runtime its host needs; macOS apps are ad hoc signed | | `Moader.nro`, `moader.nso` | Standalone copies of the matched app and resident | | `SHA256SUMS.txt` | Checksums of the packaged release assets | @@ -52,7 +52,7 @@ For a matching release checkout, audit and commit the source before packaging: python3 tools/package-release.py ``` -The packager reads the source from `HEAD`, verifies the component proof and checks the exported public tree. It writes the app, backend and Setup ZIPs, the standalone programs, `release-manifest.json` and `SHA256SUMS.txt` under `dist/releases/`. Use an empty output directory. Review the final bytes before release and record the source commit with the downloads. When refreshing assets on an existing tag, retain the tag and disclose that the ZIP source commit differs from GitHub's automatic source archives. +The base packager reads the source from `HEAD`, verifies the component proof and checks the exported public tree. It writes the app and backend ZIPs, binaries, and an intermediate universal Setup ZIP. `tools/package-setup-platform.py` turns that intermediate into five prebuilt, self-contained OS apps, ad hoc signs the macOS bundles, and writes the final manifest and checksums. The universal intermediate is not a public release asset. Use an empty output directory. Review the final bytes before release and record the source commit with the downloads. When refreshing assets on an existing tag, retain the tag and disclose that the ZIP source commit differs from GitHub's automatic source archives. ## Native changes @@ -71,7 +71,7 @@ When changing runtime log layout, keep `include/moader/runtime_log_wire.h`, the ## Verify the exported artifacts -Moader Setup uses a local controller, a dedicated Electron desktop window, graphical launchers, pinned Node 24 executables for macOS/Linux arm64/x86_64, and uv for kit-scoped Python. `tools/package-release.py` verifies the official Node, uv and Electron runtime archives and includes their license notices. It lists the desktop app in the Setup ZIP's `START_HERE.txt`. Keep `setup/desktop-app/`, `setup/host-policy.cjs`, `setup/host-tools.cjs`, `setup/launch.sh`, `setup/windows-launch.ps1`, `setup/wsl-entry.sh`, the `Moader Setup` launchers, `setup/licenses/` and `docs/SETUP_GUI.md` in public source. Do not commit `host-runtimes/` binaries to Git; the packager inserts them into the separate Setup ZIP. The command-line backend ZIP omits the Setup app and its runtimes. A public macOS release still needs project signing and notarization. Test the extracted Setup ZIP by opening its app from a moved folder, including a path with spaces or non-ASCII characters, and by inspecting its support export. Preserve the CLI fallback and the existing native proof gates. +Moader Setup uses a local controller, a dedicated Electron desktop window, pinned Node 24 executables for macOS/Linux arm64/x86_64, and uv for kit-scoped Python. `tools/package-release.py` verifies the official Node, uv and Electron runtime archives and includes their license notices. `tools/package-setup-platform.py` assembles each native executable with the matched backend inside the app's resources. Keep `setup/desktop-app/`, `setup/host-policy.cjs`, `setup/host-tools.cjs`, `setup/launch.sh`, `setup/windows-launch.ps1`, `setup/wsl-entry.sh`, `setup/licenses/` and `docs/SETUP_GUI.md` in public source. Do not commit `host-runtimes/` binaries to Git; the packager adds them to the OS downloads. The command-line backend ZIP omits the Setup app and its runtimes. The dedicated `.github/workflows/package-setup.yml` workflow stages only checksum-qualified native inputs from the existing backend release asset, packages all five apps on a macOS runner and exports the final assets for review. Public macOS distribution still needs project signing and notarization. Test an extracted platform Setup ZIP by opening its app from a moved folder, including a path with spaces or non-ASCII characters, and by inspecting its support export. Preserve the CLI fallback and the existing native proof gates. Run `node --test setup/test-controller.cjs` against matched kit inputs for host-only token, restart, uncertainty, SD-export, hash and redaction checks. Use `tools/test-ns2jb-host.py --online --node /absolute/path/to/node24` for the existing source-qualified SmileBASIC path. Keep host-only and actual-console results in separate validation headings. diff --git a/docs/SETUP_GUI.md b/docs/SETUP_GUI.md index dd1ed51..3d1e460 100644 --- a/docs/SETUP_GUI.md +++ b/docs/SETUP_GUI.md @@ -1,10 +1,20 @@ # Moader Setup -Download the separate, self-contained [v4.0.0 Moader Setup ZIP](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0.zip). It includes the matching backend files and pinned desktop runtimes, so you do not need the command-line backend ZIP too. [Installation](INSTALLATION.md) also documents the command-line routes. +Choose the prebuilt app for your operating system and architecture. Each app includes the matching backend files and its own pinned desktop runtime. The smaller [backend ZIP](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-backend-v4.0.0.zip) is for command-line use; you do not need both. -Extract the whole Setup ZIP and open the outer `Moader-Setup-...` folder. On macOS, open **Moader Setup.app**. On Linux, open **Moader Setup** in the file manager and choose Run if asked. On Windows, open **Moader Setup Windows/Moader Setup.exe** and choose a WSL2 Linux distribution in its picker. Keep the complete extracted kit together. Moader Setup opens its own desktop window. Its private local controller performs the computer work; the separate **Open Moader in browser** task opens the page hosted by the Switch. +## Download -The Setup ZIP includes the matching app, resident plugin, HEN, RO, bootstrap, a Node 24 controller runtime and a pinned Python preparation helper. You do not need the separate console app ZIP for a complete backend installation. The first host preparation fetches reviewed provider sources and, if needed, a Python distribution into the kit's state folder. Git is needed to fetch those sources. Seedsow preparation also needs clang and, on Linux, zstd. If an OS tool is missing, Setup names it. On macOS it opens the Command Line Tools installer. On Linux it can use a graphical software manager or, after an explicit click, the distribution's signed package manager with graphical administrator approval. In WSL2 it can install the named tools into the selected distribution through its signed package manager. A distribution without one of the supported package managers needs a supported desktop Linux or WSL2 environment before preparation can proceed. Nothing is installed globally by the Python helper. +- [macOS Apple Silicon](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-macos-arm64.zip) +- [macOS Intel](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-macos-x64.zip) +- [Linux ARM64](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-linux-arm64.zip) +- [Linux x64](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-linux-x64.zip) +- [Windows x64 with WSL2](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-windows-x64.zip) + +The release files are packaged by [GitHub Actions](https://github.com/H644b/Moader/actions/workflows/package-setup.yml). [Installation](INSTALLATION.md) also documents the command-line routes. + +Extract the ZIP for your computer. On macOS, open **Moader Setup.app**. On Linux, open **Moader Setup** in the file manager and choose Run if asked. On Windows, open **Moader Setup.exe** and choose a WSL2 Linux distribution in its picker. Keep the complete extracted kit together. Moader Setup opens its own desktop window. Its private local controller performs the computer work; the separate **Open Moader in browser** task opens the page hosted by the Switch. + +Each prebuilt Setup app includes the matching console app, resident plugin, HEN, RO, bootstrap, a Node 24 controller runtime and a pinned Python preparation helper. You do not need the separate console app ZIP for a complete backend installation. The first host preparation fetches reviewed provider sources and, if needed, a Python distribution into the kit's state folder. Git is needed to fetch those sources. Seedsow preparation also needs clang and, on Linux, zstd. If an OS tool is missing, Setup names it. On macOS it opens the Command Line Tools installer. On Linux it can use a graphical software manager or, after an explicit click, the distribution's signed package manager with graphical administrator approval. In WSL2 it can install the named tools into the selected distribution through its signed package manager. A distribution without one of the supported package managers needs a supported desktop Linux or WSL2 environment before preparation can proceed. Nothing is installed globally by the Python helper. ## Choose a task @@ -22,7 +32,7 @@ The support export offers a short text summary and advanced JSON. It includes re Seedsow PC setup targets Apple Silicon macOS and Linux x86_64, including WSL2 x86_64. mac2jb is a macOS route. Direct ns2jb uses native macOS or Linux Node. CivSwitch remains experimental and its host-tested workflow still needs console acceptance. Windows uses a chosen WSL2 distribution; it is not a native Windows backend. A WSL distro must have working network access and a reachable address for the chosen provider. The graphical WSL picker and Linux arm64 runtime are packaged, but have no live Windows/Linux acceptance from this development host. -The macOS launcher in the v4.0.0 kit is unsigned and unnotarized. Distribution to a quarantined macOS download requires the project's normal signing and notarization release process. Setup does not ask you to disable platform security. CLI guides remain in [Installation](INSTALLATION.md) for advanced users. +The macOS v4.0.0 apps have ad hoc signatures and are not notarized. Distribution to a quarantined macOS download requires the project's normal signing and notarization release process. Setup does not ask you to disable platform security. CLI guides remain in [Installation](INSTALLATION.md) for advanced users. ## Verification boundary diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index a0295b9..f997544 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -6,7 +6,7 @@ Moader supports [RomFS and ExeFS payloads](USAGE.md#upload-your-first-mod). The The v4.0.0 console app and resident plugin were cross-built from the release source with 4.0.0 version text. The source and binary identities are recorded in `config/release.json` and the downloadable release manifest. PRs #40, #41 and #42 passed all five CI jobs, including native update tests, setup controller tests, public-tree checks, and the Seedsow Linux source build. The native updater's host fixtures cover release selection, both file hashes, interrupted writes, recovery, plugin restart handoff, and input. No in-app update was run on a Switch 2 with these exact bytes. -The separate Setup ZIP includes the themed Moader Setup desktop app, pinned Node 24, uv and Electron runtimes, the matching console app and resident, and the unchanged source-qualified kaiHEN and Seedsow standalone components. The command-line backend ZIP omits Moader Setup and its desktop runtimes. The original combined v4 candidate ZIP passed the packager's member and CRC checks; independent inspection found all five desktop runtime targets, both matching binaries and no private FS capture. After extraction on this Mac, the packaged **Moader Setup.app** launcher started its local controller and served its health, verified kit state and themed UI over loopback. This checks the launch path without opening an Electron window. The earlier pre-release Mac desktop checks below used 3.5.0-labelled contents. A fresh native setup, exact v4.0.0 device connection, Linux or Windows desktop launch, and gameplay result remain unverified. +The platform Setup app downloads each include the themed Moader Setup desktop app, pinned host-specific Node 24, uv and Electron runtimes, the matching console app and resident, and the unchanged source-qualified kaiHEN and Seedsow standalone components. The command-line backend ZIP omits Moader Setup and its desktop runtimes. The original combined v4 candidate ZIP passed the packager's member and CRC checks; independent inspection found all five desktop runtime targets, both matching binaries and no private FS capture. After extraction on this Mac, the packaged **Moader Setup.app** launcher started its local controller and served its health, verified kit state and themed UI over loopback. This checks the launch path without opening an Electron window. The earlier pre-release Mac desktop checks below used 3.5.0-labelled contents. A fresh native setup, exact v4.0.0 device connection, Linux or Windows desktop launch, and gameplay result remain unverified. ## Moader Setup pre-release host checks diff --git a/docs/releases/v4.0.0.md b/docs/releases/v4.0.0.md index 1b35b15..90cfab1 100644 --- a/docs/releases/v4.0.0.md +++ b/docs/releases/v4.0.0.md @@ -1,19 +1,19 @@ # Moader v4.0.0 — Setup and in-app updates -The separate **Moader Setup** download is a self-contained desktop kit for guided host preparation, SD copying, connection checks and support export. It includes the complete backend, pinned Node, uv and Electron runtimes, and launchers for macOS, Linux and Windows with WSL2. The smaller backend ZIP is for command-line use. The console app adds **Settings → Updates** for manual or optional automatic checks of the latest stable official release. It verifies both app and resident plugin downloads before installing them, can recover an interrupted update, and prompts you to reopen the app after the plugin restarts. +Five separate **Moader Setup** downloads provide prebuilt desktop apps for macOS, Linux and Windows with WSL2. Each self-contained app has the matching backend files and only its platform's pinned Node, uv and Electron runtimes. The smaller backend ZIP is for command-line use. The console app adds **Settings → Updates** for manual or optional automatic checks of the latest stable official release. It verifies both app and resident plugin downloads before installing them, can recover an interrupted update, and prompts you to reopen the app after the plugin restarts. ## Downloads - [Moader-v4.0.0.zip](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-v4.0.0.zip): console app and matching resident plugin in SD layout. -- [Moader-Setup-v4.0.0.zip](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0.zip): self-contained desktop app and complete backend files. Download this for guided setup. +- Moader Setup for [macOS Apple Silicon](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-macos-arm64.zip), [macOS Intel](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-macos-x64.zip), [Linux ARM64](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-linux-arm64.zip), [Linux x64](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-linux-x64.zip), or [Windows x64 with WSL2](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-Setup-v4.0.0-windows-x64.zip): prebuilt, self-contained desktop app for your computer. - [Moader-backend-v4.0.0.zip](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader-backend-v4.0.0.zip): smaller command-line backend kit with public tools, matched binaries, complete patched kaiHEN set, and Seedsow standalone A/B implementation with prebuilt bootstrap. - [Moader.nro](https://github.com/H644b/Moader/releases/download/v4.0.0/Moader.nro) and [moader.nso](https://github.com/H644b/Moader/releases/download/v4.0.0/moader.nso): individual app and resident binaries. - [SHA256SUMS.txt](https://github.com/H644b/Moader/releases/download/v4.0.0/SHA256SUMS.txt) and [release-manifest.json](https://github.com/H644b/Moader/releases/download/v4.0.0/release-manifest.json): asset checksums and exact source and component identities. [Installation](../INSTALLATION.md) · [Moader Setup guide](../SETUP_GUI.md) · [In-app updates](../USAGE.md#update-the-app-and-resident-plugin) · [Seedsow standalone requirements](../SEEDSOW_STANDALONE.md) -The v4.0.0 assets were refreshed after the tag to separate Setup from the command-line backend. The release manifest records the exact source commit for the refreshed ZIPs. The standalone Moader A route still needs an exact qualified local FS capture. The public kit does not contain that console-derived capture or its payload. The pinned kaiHEN RO, HEN, regular bootstrap and standalone bootstrap retain their recorded identities. The macOS desktop launcher is unsigned and unnotarized; consult the [Setup guide](../SETUP_GUI.md#platform-and-release-limits) before using it on a quarantined download. +The v4.0.0 assets were refreshed after the tag to make the command-line backend smaller and provide separate prebuilt Setup apps. GitHub Actions packages the five OS and architecture downloads. The release manifest records the exact source commit for the refreshed ZIPs. The standalone Moader A route still needs an exact qualified local FS capture. The public kit does not contain that console-derived capture or its payload. The pinned kaiHEN RO, HEN, regular bootstrap and standalone bootstrap retain their recorded identities. The macOS desktop apps have ad hoc signatures and are not notarized; consult the [Setup guide](../SETUP_GUI.md#platform-and-release-limits) before using it on a quarantined download. ## Validation scope -PRs #40–#42 passed the repository's five CI checks. The in-app updater's host tests cover release parsing, file integrity, interrupted installation, recovery, restart handoff and input. The setup controller's host tests cover installer orchestration, SD readback, support export and failure handling. The themed desktop renderer was checked in 18 simulated layouts and states; a pre-release extracted Mac kit launched and completed host-only preparation for four backend methods. The exact v4.0.0 app, plugin and backend ZIP are built and hash-verified from the source commit in the manifest. A fresh Switch 2 installation, in-app update and the published desktop kit's Linux and Windows launchers have not been tested on hardware. [Detailed validation](../VALIDATION.md#v400-setup-and-update-release-scope). +PRs #40–#42 passed the repository's five CI checks. The in-app updater's host tests cover release parsing, file integrity, interrupted installation, recovery, restart handoff and input. The setup controller's host tests cover installer orchestration, SD readback, support export and failure handling. The themed desktop renderer was checked in 18 simulated layouts and states; a pre-release extracted Mac kit launched and completed host-only preparation for four backend methods. The exact v4.0.0 app, plugin, backend ZIP and five prebuilt Setup apps are built and hash-verified from the source commit in the manifest. A fresh Switch 2 installation, in-app update and the published desktop kit's Linux and Windows launchers have not been tested on hardware. [Detailed validation](../VALIDATION.md#v400-setup-and-update-release-scope). diff --git a/setup/desktop-app/main.cjs b/setup/desktop-app/main.cjs index b1017fe..9ebcce0 100644 --- a/setup/desktop-app/main.cjs +++ b/setup/desktop-app/main.cjs @@ -6,7 +6,11 @@ const net = require('node:net'); const {spawn} = require('node:child_process'); const {app, BrowserWindow, dialog, Menu, shell} = require('electron'); -const kit = path.resolve(__dirname, '../..'); +// A release app carries its matched backend beside Electron's app resources. +// The source-tree launcher keeps using the repository root for development. +const packagedKit = path.join(process.resourcesPath, 'kit'); +const usesPackagedKit = fs.existsSync(path.join(packagedKit, 'config/release.json')); +const kit = usesPackagedKit ? packagedKit : path.resolve(__dirname, '../..'); const logo = path.join(kit, 'branding/mark-alpha.png'); app.setName('Moader Setup'); if (process.platform === 'darwin') Menu.setApplicationMenu(Menu.buildFromTemplate([ @@ -54,7 +58,8 @@ function startController() { path.join(kit, 'setup/windows-launch.ps1'), kit] : [path.join(kit, 'setup/launch.sh'), kit]; const child = spawn(executable, args, {cwd: kit, windowsHide: true, - env: {...process.env, MOADER_SETUP_DETACH: '1', MOADER_SETUP_NO_OPEN: '1'}, + env: {...process.env, MOADER_SETUP_DETACH: '1', MOADER_SETUP_NO_OPEN: '1', + MOADER_SETUP_FORCE_COPY: usesPackagedKit ? '1' : process.env.MOADER_SETUP_FORCE_COPY || '0'}, stdio: ['ignore', 'pipe', 'pipe']}); let output = '', errorText = '', settled = false; const timer = setTimeout(() => finish(Error('The setup controller did not open in time. Check the extracted kit and reopen Moader Setup.')), 300000); diff --git a/setup/launch.sh b/setup/launch.sh index c9f6270..d34968f 100755 --- a/setup/launch.sh +++ b/setup/launch.sh @@ -34,8 +34,10 @@ EOF [ "$arch" != unsupported ] || show_error "This computer architecture is not supported by the included controller runtime." node="$kit/host-runtimes/node-v24.22.3/$platform-$arch/node" [ -f "$node" ] || show_error "The included Node 24 runtime for this computer is missing. Extract the complete backend kit again." -if ! mkdir -p "$kit/state/setup" 2>/dev/null || ! : > "$kit/state/setup/.write-check" 2>/dev/null; then - id=$({ printf '%s' "$kit"; cat "$kit/config/release.json" "$kit/setup/controller.cjs" \ +if [ "${MOADER_SETUP_FORCE_COPY:-0}" = 1 ] || + ! mkdir -p "$kit/state/setup" 2>/dev/null || + ! : > "$kit/state/setup/.write-check" 2>/dev/null; then + id=$({ printf '%s' "$kit"; cat "$kit/config/release.json" "$kit/setup/controller.cjs" "$kit/setup/launch.sh" \ "$kit/dist/Moader.nro" "$kit/dist/moader.nso" \ "$kit/vendor/kaihen-mo/hen/main" "$kit/vendor/kaihen-mo/ro/main" \ "$kit/vendor/kaihen-mo/bootstrap.bin"; } | @@ -54,6 +56,7 @@ if ! mkdir -p "$kit/state/setup" 2>/dev/null || ! : > "$kit/state/setup/.write-c else rm -f "$kit/state/setup/.write-check" fi +mkdir -p "$kit/state/setup" chmod u+x "$node" 2>/dev/null || : version=$("$node" --version 2>/dev/null || :) [ "$version" = v24.22.3 ] || show_error "The included Node runtime failed its version check." diff --git a/setup/wsl-entry.sh b/setup/wsl-entry.sh index 58e1d54..1f9cb81 100755 --- a/setup/wsl-entry.sh +++ b/setup/wsl-entry.sh @@ -5,7 +5,7 @@ source_kit=$1 base="$HOME/.local/share/Moader Setup/wsl-kits" mkdir -p "$base" id=$({ printf '%s' "$source_kit"; cat "$source_kit/config/release.json" \ - "$source_kit/setup/controller.cjs" "$source_kit/dist/Moader.nro" \ + "$source_kit/setup/controller.cjs" "$source_kit/setup/launch.sh" "$source_kit/dist/Moader.nro" \ "$source_kit/dist/moader.nso" "$source_kit/vendor/kaihen-mo/hen/main" \ "$source_kit/vendor/kaihen-mo/ro/main" \ "$source_kit/vendor/kaihen-mo/bootstrap.bin"; } | diff --git a/tools/build-wiki.py b/tools/build-wiki.py index d498e7e..b9d53cb 100644 --- a/tools/build-wiki.py +++ b/tools/build-wiki.py @@ -142,7 +142,7 @@ def build(): ## Do I need a Mac? -No. The separate v4.0.0 Setup ZIP includes the desktop app and complete backend files. The smaller command-line backend ZIP also supports direct ns2jb and PC-driven Seedsow Lullaby from Linux x86_64 or WSL2 x86_64. macOS users can also choose mac2jb. PC-driven Seedsow needs its pinned GUI and host SDK preparation. The experimental [on-console Seedsow route](Seedsow-Standalone) prepares its SD and save once on a computer, then can run without one. Its Moader A route requires a qualified local FS capture that is not bundled. [Installation](Installation) covers the method choices and host requirements. +No. The v4.0.0 Setup downloads provide prebuilt macOS, Linux and Windows apps, each with its complete backend files. The smaller command-line backend ZIP also supports direct ns2jb and PC-driven Seedsow Lullaby from Linux x86_64 or WSL2 x86_64. macOS users can also choose mac2jb. PC-driven Seedsow needs its pinned GUI and host SDK preparation. The experimental [on-console Seedsow route](Seedsow-Standalone) prepares its SD and save once on a computer, then can run without one. Its Moader A route requires a qualified local FS capture that is not bundled. [Installation](Installation) covers the method choices and host requirements. ## Do I need FS access every time I toggle a mod? diff --git a/tools/package-release.py b/tools/package-release.py index 0079d3e..9e2e4db 100644 --- a/tools/package-release.py +++ b/tools/package-release.py @@ -501,9 +501,10 @@ def main(): computer-side tools. It supports the command-line routes in docs/INSTALLATION.md. Open that guide and follow the method for your console and computer. -For a guided desktop setup instead, download the separate self-contained -Moader-Setup-{tag}.zip asset. It includes this backend and its own runtimes; -you do not need to download both ZIPs. +For guided desktop setup, choose the separate Moader Setup download for your +computer at https://github.com/{spec['repository']}/releases/tag/{tag}. +Each prebuilt app includes this backend and its matching runtime; you do not +need to download both ZIPs. The on-console Seedsow A route requires a qualified local FS capture. No console capture, derived payload, or private runtime state is included. diff --git a/tools/package-setup-platform.py b/tools/package-setup-platform.py new file mode 100644 index 0000000..7407487 --- /dev/null +++ b/tools/package-setup-platform.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python3 +"""Turn the checked Setup kit into five self-contained prebuilt desktop apps.""" +from pathlib import Path +import argparse +import importlib.util +import json +import os +import plistlib +import shutil +import subprocess +import sys +import tempfile +import zipfile + +ROOT = Path(__file__).resolve().parent.parent +TARGETS = { + 'macos-arm64': ('darwin-arm64', 'darwin-arm64'), + 'macos-x64': ('darwin-x64', 'darwin-x64'), + 'linux-arm64': ('linux-arm64', 'linux-arm64'), + 'linux-x64': ('linux-x64', 'linux-x64'), + 'windows-x64': ('win32-x64', 'linux-x64'), +} + + +def release_package(): + spec = importlib.util.spec_from_file_location('moader_platform_release', ROOT / 'tools/package-release.py') + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def inventory(archive, prefix, package): + files = {} + for info in archive.infolist(): + package.require(info.filename.startswith(prefix), 'Unexpected Setup source member') + name = info.filename[len(prefix):] + package.require(name and name not in files and not info.is_dir(), 'Duplicate or empty Setup source member') + path = Path(name) + package.require(not path.is_absolute() and '..' not in path.parts, 'Unsafe Setup source member') + files[name] = (package.ArchiveMember(Path(archive.filename), info.filename), info.external_attr >> 16) + return files + + +def files_for_target(source, target, tag, package, archive): + electron, controller = TARGETS[target] + folder = f'Moader-Setup-{tag}-{target}/' + if target.startswith('macos-'): + app = 'Moader Setup.app/' + resources = app + 'Contents/Resources/' + runtime_prefix = f'host-runtimes/electron-v{package.HOST_ELECTRON_VERSION}/{electron}/Electron.app/' + elif target.startswith('linux-'): + app = '' + resources = 'resources/' + runtime_prefix = f'host-runtimes/electron-v{package.HOST_ELECTRON_VERSION}/{electron}/' + else: + app = '' + resources = 'resources/' + runtime_prefix = 'Moader Setup Windows/' + output = {} + + def add(destination, value): + package.require(destination not in output, 'Duplicate platform member: ' + destination) + output[destination] = value + + for name, value in source.items(): + if not name.startswith(runtime_prefix): + continue + relative = name[len(runtime_prefix):] + if relative in ('resources/app/main.cjs', 'resources/app/package.json'): + continue + if target.startswith('linux-') and relative == 'electron': + relative = 'Moader Setup' + destination = app + relative + if target.startswith('macos-') and relative == 'Contents/Info.plist': + info = plistlib.loads(archive.read(value[0].name)) + info['CFBundleDisplayName'] = 'Moader Setup' + info['CFBundleName'] = 'Moader Setup' + info['CFBundleIdentifier'] = 'com.moader.setup' + info['CFBundleShortVersionString'] = tag.removeprefix('v') + add(folder + destination, (plistlib.dumps(info), value[1])) + else: + add(folder + destination, value) + package.require(any(name.endswith('Moader Setup.exe') for name in output) if target == 'windows-x64' else + any(name.endswith('/MacOS/Electron') for name in output) if target.startswith('macos-') else + folder + 'Moader Setup' in output, 'Prebuilt Electron program is missing') + + excluded = ('host-runtimes/', 'Moader Setup.app/', 'Moader Setup Windows/') + for name, value in source.items(): + if name.startswith(excluded) or name in ('Moader Setup', 'Moader Setup Windows.cmd', 'START_HERE.txt'): + continue + add(folder + resources + 'kit/' + name, value) + for runtime_name in ( + f'host-runtimes/node-v{package.HOST_NODE_VERSION}/{controller}/node', + f'host-runtimes/node-v{package.HOST_NODE_VERSION}/LICENSE', + f'host-runtimes/uv-v{package.HOST_UV_VERSION}/{controller}/uv', + ): + package.require(runtime_name in source, 'Setup controller runtime is missing: ' + runtime_name) + add(folder + resources + 'kit/' + runtime_name, source[runtime_name]) + for name in ('main.cjs', 'package.json'): + add(folder + resources + 'app/' + name, source['setup/desktop-app/' + name]) + intro = f'''Moader Setup {tag} for {target} + +Open Moader Setup.app on macOS, Moader Setup on Linux, or Moader Setup.exe on +Windows. Keep the extracted app folder together. The app contains its matching +backend files and a prebuilt runtime for this computer; the command-line +backend ZIP is a separate, optional download. + +The on-console Seedsow A route still requires a qualified local FS capture. +No private capture, derived payload, save, or pairing code is included. +''' + add(folder + 'README.txt', (intro.encode(), 0o100644)) + return output + + +def sign_macos(path, tag): + with tempfile.TemporaryDirectory(prefix='moader-macos-sign-') as temporary: + temporary = Path(temporary) + unsigned = temporary / 'unsigned.zip' + path.replace(unsigned) + subprocess.run(['ditto', '-x', '-k', str(unsigned), str(temporary / 'extracted')], check=True) + folder = temporary / 'extracted' / path.stem + app = folder / 'Moader Setup.app' + subprocess.run(['codesign', '--force', '--deep', '--sign', '-', str(app)], check=True) + subprocess.run(['codesign', '--verify', '--deep', '--strict', str(app)], check=True) + subprocess.run(['ditto', '-c', '-k', '--keepParent', str(folder), str(path)], check=True) + with zipfile.ZipFile(path) as archive: + if archive.testzip() is not None: + raise ValueError('Signed macOS Setup ZIP failed CRC validation: ' + tag) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--release-dir', required=True, type=Path) + parser.add_argument('--keep-universal', action='store_true') + args = parser.parse_args() + package = release_package() + directory = args.release_dir.resolve() + manifest_path = directory / 'release-manifest.json' + manifest = json.loads(manifest_path.read_text()) + tag = manifest['tag'] + universal_name = f'Moader-Setup-{tag}.zip' + universal = directory / universal_name + record = manifest['assets'][universal_name] + package.require(universal.is_file() and universal.stat().st_size == record['bytes'] and + package.sha(universal.read_bytes()) == record['sha256'], + 'Universal Setup input differs from the release manifest') + assets = {} + with zipfile.ZipFile(universal) as archive: + source = inventory(archive, f'Moader-Setup-{tag}/', package) + timestamp = archive.infolist()[0].date_time + for target in TARGETS: + name = f'Moader-Setup-{tag}-{target}.zip' + path = directory / name + package.write_zip(path, files_for_target(source, target, tag, package, archive), timestamp) + if target.startswith('macos-'): + package.require(sys.platform == 'darwin', 'macOS Setup apps must be packaged and signed on macOS') + sign_macos(path, tag) + assets[target] = name + print('Packaged prebuilt Setup app: ' + name, flush=True) + manifest['assets'].pop(universal_name) + for name in assets.values(): + path = directory / name + manifest['assets'][name] = {'bytes': path.stat().st_size, 'sha256': package.sha(path.read_bytes())} + manifest.pop('setupGuiAsset', None) + manifest['setupGuiAssets'] = assets + manifest['setupPackageWorkflow'] = '.github/workflows/package-setup.yml' + manifest_path.write_text(json.dumps(manifest, indent=2) + '\n') + checksums = directory / 'SHA256SUMS.txt' + checksums.write_text(''.join( + package.sha((directory / name).read_bytes()) + ' ' + name + '\n' + for name in [f'Moader-{tag}.zip', f'Moader-backend-{tag}.zip', + *assets.values(), 'Moader.nro', 'moader.nso', 'release-manifest.json'])) + if not args.keep_universal: + universal.unlink() + print('Verified five platform apps, manifest, and release checksums') + + +if __name__ == '__main__': + try: + main() + except (OSError, ValueError, subprocess.CalledProcessError) as error: + raise SystemExit('Platform packaging stopped: ' + str(error)) diff --git a/tools/stage-release-inputs.py b/tools/stage-release-inputs.py new file mode 100644 index 0000000..7c84d90 --- /dev/null +++ b/tools/stage-release-inputs.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +"""Recover only checksum-pinned v4 build inputs from a published backend ZIP.""" +from pathlib import Path +import argparse +import hashlib +import importlib.util +import json +import zipfile + +ROOT = Path(__file__).resolve().parent.parent + + +def module(name, path): + spec = importlib.util.spec_from_file_location(name, path) + loaded = importlib.util.module_from_spec(spec) + spec.loader.exec_module(loaded) + return loaded + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--backend-zip', type=Path, required=True) + args = parser.parse_args() + release = json.loads((ROOT / 'config/release.json').read_text()) + backend = module('moader_stage_backend', ROOT / 'tools/setup-backend.py') + prefix = f"Moader-backend-{release['tag']}/" + expected = { + 'dist/Moader.nro': ('dist/Moader.nro', release['binaries']['Moader.nro']), + 'dist/moader.nso': ('dist/moader.nso', release['binaries']['moader.nso']), + 'vendor/kaihen-mo/hen/main': ('vendor/kaihen-mo/hen/main', release['patched_hen']), + 'vendor/kaihen-mo/ro/main': ('vendor/kaihen-mo/ro/main', release['patched_ro']), + 'vendor/kaihen-mo/bootstrap.bin': ('vendor/kaihen-mo/bootstrap.bin', release['patched_bootstrap']), + 'research/artifacts/kaiHEN-20261114c.zip': ( + 'research/artifacts/kaiHEN-20261114c.zip', {'sha256': backend.KAIHEN_SHA}), + 'prebuilt/standalone-bootstrap/bootstrap.bin': ( + 'build/standalone-bootstrap/bootstrap.bin', release['standalone']['bootstrap']), + 'prebuilt/standalone-bootstrap/proof.json': ( + 'build/standalone-bootstrap/proof.json', {'maxBytes': 1024 * 1024}), + } + with zipfile.ZipFile(args.backend_zip) as archive: + for member, (target, record) in expected.items(): + info = archive.getinfo(prefix + member) + if info.is_dir() or info.file_size > record.get('maxBytes', 200 * 1024 * 1024): + raise ValueError('Unexpected release input size: ' + member) + content = archive.read(info) + if 'bytes' in record and len(content) != record['bytes']: + raise ValueError('Release input length differs: ' + member) + if 'sha256' in record and hashlib.sha256(content).hexdigest() != record['sha256']: + raise ValueError('Release input digest differs: ' + member) + path = ROOT / target + if path.is_symlink() or path.exists() and (not path.is_file() or path.read_bytes() != content): + raise ValueError('Existing release input differs: ' + target) + path.parent.mkdir(parents=True, exist_ok=True) + if not path.exists(): + path.write_bytes(content) + print(f'Staged {len(expected)} checksum-qualified release inputs from {args.backend_zip.name}') + + +if __name__ == '__main__': + main() diff --git a/tools/test-ns2jb-host.py b/tools/test-ns2jb-host.py index 5ff4831..7bbc627 100644 --- a/tools/test-ns2jb-host.py +++ b/tools/test-ns2jb-host.py @@ -339,8 +339,9 @@ def app_zip(command, **kwargs): with zipfile.ZipFile(output/'Moader-backend-v0.0.0-fixture.zip') as archive: prefix='Moader-backend-v0.0.0-fixture/' require(archive.read(prefix+'vendor/kaihen-mo/hen/main')==hen and archive.read(prefix+'vendor/kaihen-mo/bootstrap.bin')==bootstrap,'Host ZIP omitted or changed paired binary') - require(b'Moader-Setup-v0.0.0-fixture.zip' in archive.read(prefix+'START_HERE.txt'), - 'Command-line kit did not direct users to the separate Setup asset') + require(b'/releases/tag/v0.0.0-fixture' in archive.read(prefix+'START_HERE.txt') and + b'Moader Setup download' in archive.read(prefix+'START_HERE.txt'), + 'Command-line kit did not direct users to the separate Setup downloads') with zipfile.ZipFile(output/'Moader-Setup-v0.0.0-fixture.zip') as archive: prefix='Moader-Setup-v0.0.0-fixture/' require(archive.read(prefix+'vendor/kaihen-mo/hen/main')==hen and diff --git a/tools/test-package-setup-platform.py b/tools/test-package-setup-platform.py new file mode 100644 index 0000000..a29fd68 --- /dev/null +++ b/tools/test-package-setup-platform.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Exercise the OS app layouts with synthetic runtimes; no downloads or signing.""" +from pathlib import Path +import importlib.util +import plistlib +import tempfile +import zipfile + +ROOT = Path(__file__).resolve().parent.parent +spec = importlib.util.spec_from_file_location('moader_setup_layout', ROOT / 'tools/package-setup-platform.py') +layout = importlib.util.module_from_spec(spec) +spec.loader.exec_module(layout) +package = layout.release_package() + + +def main(): + tag = 'v4.0.0' + prefix = f'Moader-Setup-{tag}/' + with tempfile.TemporaryDirectory(prefix='moader-platform-fixture-') as folder: + folder = Path(folder) + original = folder / 'universal.zip' + files = { + 'config/release.json': b'{"version":"4.0.0"}', + 'setup/desktop-app/main.cjs': b'// desktop entry', + 'setup/desktop-app/package.json': b'{"main":"main.cjs"}', + 'setup/launch.sh': b'#!/bin/sh\n', + 'dist/Moader.nro': b'NRO0fixture', + 'vendor/kaihen-mo/hen/main': b'NSO0fixture', + 'host-runtimes/node-v24.22.3/LICENSE': b'Node notice', + } + for host in ('darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64'): + files[f'host-runtimes/node-v24.22.3/{host}/node'] = b'node ' + host.encode() + files[f'host-runtimes/uv-v0.12.16/{host}/uv'] = b'uv ' + host.encode() + for target, (electron, _) in layout.TARGETS.items(): + if target.startswith('macos-'): + base = f'host-runtimes/electron-v45.4.1/{electron}/Electron.app/' + files[base + 'Contents/MacOS/Electron'] = b'mac binary' + files[base + 'Contents/Info.plist'] = plistlib.dumps({'CFBundleName': 'Electron'}) + elif target.startswith('linux-'): + files[f'host-runtimes/electron-v45.4.1/{electron}/electron'] = b'linux binary' + else: + files['Moader Setup Windows/Moader Setup.exe'] = b'windows binary' + with zipfile.ZipFile(original, 'w') as archive: + for name, data in sorted(files.items()): + info = zipfile.ZipInfo(prefix + name) + info.create_system = 3 + info.external_attr = 0o100644 << 16 + archive.writestr(info, data) + with zipfile.ZipFile(original) as archive: + source = layout.inventory(archive, prefix, package) + for target in layout.TARGETS: + path = folder / (target + '.zip') + package.write_zip(path, layout.files_for_target(source, target, tag, package, archive), + archive.infolist()[0].date_time) + root = f'Moader-Setup-{tag}-{target}/' + with zipfile.ZipFile(path) as built: + names = set(built.namelist()) + if target.startswith('macos-'): + resources = root + 'Moader Setup.app/Contents/Resources/' + assert root + 'Moader Setup.app/Contents/MacOS/Electron' in names + plist = plistlib.loads(built.read(root + 'Moader Setup.app/Contents/Info.plist')) + assert plist['CFBundleName'] == 'Moader Setup' + else: + resources = root + 'resources/' + assert root + ('Moader Setup.exe' if target == 'windows-x64' else 'Moader Setup') in names + assert built.read(resources + 'app/main.cjs') == b'// desktop entry' + assert built.read(resources + 'kit/dist/Moader.nro') == b'NRO0fixture' + assert len([n for n in names if n.endswith('/node')]) == 1 + assert len([n for n in names if n.endswith('/uv')]) == 1 + print('Five self-contained prebuilt app layouts passed synthetic archive checks') + + +if __name__ == '__main__': + main()