Legacy MagiskOnWSAOld build pipeline
Overview
MagiskOnWSAOld/scripts/** is the retained legacy build pipeline for old WSA builds. Its entry point is MagiskOnWSAOld/…/build.sh, which runs from the scripts directory, creates a temporary build workspace, writes cross-step state to WSA_WORK_ENV, downloads artifacts into MagiskOnWSAOld/download, modifies unpacked WSA system images, and emits the final folder or archive under MagiskOnWSAOld/output. Treat this as separate from the active MagiskOnWSA pipeline: these scripts carry their own option matrix, download sources, image layout assumptions, root/GApps integration logic, and installer patching paths, so changes here should be reviewed as legacy-build behavior rather than assumed to mirror active scripts with similar names.
Covered scripts map to these responsibilities:
- MagiskOnWSAOld/…/build.sh orchestrates the end-to-end build. It validates options (
--arch,--release-type,--magisk-ver,--gapps-brand,--custom-model,--root-sol,--compress-format,--after-compress,--remove-amazon), activatesMagiskOnWSAOld/python3-envwhen present, generates download lists, invokesaria2c, extracts WSA/Magisk/KernelSU/MindTheGapps payloads, converts WSA VHDX images to raw images, mounts either EROFS viaMagiskOnWSAOld/bin/EROFS/*plus overlayfs or EXT4 via loop mounts, injects root/GApps/extra packages, patches properties, repacks images back to VHDX, updates installer resources, and records GitHub Actions outputs through$GITHUB_OUTPUT. - MagiskOnWSAOld/…/generateWSALinks.py talks to Microsoft FE3 delivery SOAP endpoints using XML templates from MagiskOnWSAOld/…/GetCookie.xml, MagiskOnWSAOld/…/WUIDRequest.xml, and MagiskOnWSAOld/…/FE3FileUrl.xml. It appends aria2 entries for the selected WSA bundle, Microsoft.UI.Xaml, VCLibs, and UWPDesktop VCLibs to
download.list, and writesWSA_VER/WSA_MAJOR_VERintoWSA_WORK_ENV. For--release-type latest, build.sh bypasses this script and pulls frombubbles-wow/WSA-Archiveplus hard-coded Xaml/VCLibs URLs. - MagiskOnWSAOld/…/generateMagiskLink.py resolves the Magisk ZIP URL for
stable,beta,canary,debug,delta, oralpha, then appends an aria2 entry namedmagisk-<version>.zip. It uses Android-like request headers and falls back to jsdelivr for the topjohnwu and HuskyDG JSON manifests. - MagiskOnWSAOld/…/generateKernelSULink.py resolves a fixed KernelSU release tag (
v2.1.2) for a WSA kernel version chosen in build.sh, appends both the kernel ZIP andKernelSU.apkto the aria2 list, and writesKERNELSU_VERintoWSA_WORK_ENVfor later artifact naming. - MagiskOnWSAOld/…/generateGappsLink.py resolves the latest
YT-Advanced/MindTheGappsBuilderasset matching Android 13 and the requested architecture, then appends it under the build-selectedMindTheGapps-<arch>-13.0.zipname. - MagiskOnWSAOld/…/extractWSA.py unpacks the architecture-specific WSA package from the downloaded MSIX bundle into the temporary
wsa/<arch>tree, extracts language/scale resource packages intopriandxml, and writesWSA_VER/WSA_RELinto the env file. - MagiskOnWSAOld/…/extractMagisk.py unpacks architecture-specific Magisk shared libraries from the Magisk APK/ZIP into
WORK_DIR/magisk, normalizes them into executable names expected by build.sh (magisk64,magisk32,magiskinit,magiskpolicy,busybox, etc.), extracts host-sidemagiskpolicy, and recordsMAGISK_VERSION_NAME/MAGISK_VERSION_CODEinWSA_WORK_ENV. - MagiskOnWSAOld/…/fixGappsProp.py rewrites build properties after GApps integration when
--custom-modelis notnone. It editsbuild.propfiles under the mounted WSA root (system,vendor,vendor/odm/etc, andvendor/vendor_dlkm/etc) to set Google brand/manufacturer/device/model values and recompute build descriptions and fingerprints. - MagiskOnWSAOld/…/requirements.txt declares only the Python packages used by the helper scripts:
requestsandpackaging.
The legacy pipeline’s main data flow is file based. Link generators append aria2-compatible triplets to MagiskOnWSAOld/download/download.list; extraction helpers and link generators communicate discovered versions by mutating the shell-sourced WSA_WORK_ENV; build.sh moves the unpacked WSA tree through temporary raw images and mounted partitions; the final artifact name is derived from WSA_VER, WSA_REL, selected root solution, GApps state, custom model, and Amazon removal state. The build also reaches outside scripts for fixed assets: XML request/resource files under MagiskOnWSAOld/xml, installer scripts under MagiskOnWSAOld/installer, EROFS tools under MagiskOnWSAOld/bin/EROFS, and architecture-specific extra system packages under MagiskOnWSAOld/<arch>/system.
Root and GApps handling is embedded in build.sh rather than delegated to separate modules. Magisk integration copies the normalized files from extractMagisk.py into debug_ramdisk, appends loadpolicy.sh, modifies vendor_file_contexts, uses host-side magiskpolicy to patch precompiled_sepolicy, and appends Magisk lifecycle hooks to init rc files. KernelSU integration instead replaces Tools/kernel with the kernel unpacked from the KernelSU ZIP. MindTheGapps integration copies system_ext and product payloads, repairs ownership/modes/xattrs, and applies a fixed set of SELinux allow rules with Magisk policy tooling even when Magisk is used only as a policy helper for GApps.
Image handling differs by detected filesystem type in build.sh. EROFS images are mounted read-only with fuse.erofs, overlaid with writable upperdirs, then rebuilt with mkfs.erofs after modifications. EXT4 images are converted to writable form, resized for expected additions, mounted directly, shrunk after unmount, then all partitions are converted back to fixed VHDX with qemu-img. This means changes to injected files, partition paths, or SELinux labels can affect both filesystem branches and must be checked in both paths.
Coupling
- If MagiskOnWSAOld/…/build.sh changes any generated filename, also update the corresponding helper call and output name: generateWSALinks.py, generateMagiskLink.py, generateKernelSULink.py, and generateGappsLink.py append exact
out=names that build.sh later tests inMagiskOnWSAOld/download. - If the contents or syntax of
WSA_WORK_ENVchanges, update every localPropimplementation in generateWSALinks.py, generateKernelSULink.py, extractWSA.py, and extractMagisk.py; build.sh sources the file as shell assignments, while the Python helpers rewrite it as simplekey=valuelines. - If WSA bundle filenames or Microsoft FE3 response formats change, review generateWSALinks.py and extractWSA.py together: the former detects the latest WSA package and writes WSA version state from FE3 metadata, while the latter parses extracted package filenames to set
WSA_VERandWSA_RELused by artifact naming. - If KernelSU support is extended to a new WSA release, update both build.sh and generateKernelSULink.py: build.sh maps
WSA_MAJOR_VERto a kernel version and output filename before the generator searches the fixed KernelSU release assets for that exact kernel string. - If Magisk APK packaging changes, update extractMagisk.py and the Magisk integration block in build.sh together. The extractor normalizes library names from APK paths, and build.sh assumes those normalized names exist when patching interpreters, copying to
debug_ramdisk, and applying SELinux policy. - If fixGappsProp.py changes property keys or fingerprint construction, verify the custom-model map and invocation in build.sh; the shell passes product codename/model strings and expects the mounted WSA root layout used by the helper.
- If installer files or launch URIs change, review the installer patching section in build.sh. It mutates
MagiskOnWSAOld/installer/Install.ps1and copiesMagiskOnWSAOld/installer/<arch>/Install.ps1,MakePri.ps1, andRun.batinto the output package, so path or URI drift can silently produce stale installers.
Risks
- MagiskOnWSAOld/…/build.sh edits files outside the temporary workspace, including
MagiskOnWSAOld/installer/Install.ps1, withsed -i. If this legacy script is run repeatedly or concurrently, installer comments/URI substitutions can accumulate in the source tree and affect later old builds. - MagiskOnWSAOld/…/build.sh has separate EROFS and EXT4 mount/repack branches. If a change is tested only against one filesystem type, the other branch can still fail to mount, label, resize, or repack WSA images.
- MagiskOnWSAOld/…/generateGappsLink.py assumes a matching MindTheGapps asset exists and prints
linkafter the loop. If GitHub returns a successful release without a matching Android 13 architecture ZIP, the script can fail at runtime before writing the aria2 entry. - MagiskOnWSAOld/…/generateKernelSULink.py hard-codes KernelSU release tag
v2.1.2, while build.sh hard-codes supported WSA major versions and kernel versions. New WSA builds can be rejected or receive no kernel asset until both mappings are updated. - MagiskOnWSAOld/…/extractWSA.py only assigns
zip_pathwhen it sees a bundle entry whose filename contains the requested architecture. If Microsoft package naming changes or the wrong architecture is downloaded, the final extraction step can reference an unset path instead of failing early with a clear missing-package error.