Modern Apps git

← MAOS.git

maos: add key-gen, branding, Updater config, OTA build/publish, and build runbook

Commit
d35399733c9cc14dad3ceda5658e74296477717a
Author
Vayun Mathur <[email protected]>
When
2026-08-09 05:22 UTC (3 months ago)
Parents
28a73d2

Diff

.gitignore
diff --git a/.gitignore b/.gitignoreindex 159cb26..4c624ee 100644--- a/.gitignore+++ b/.gitignore@@ -1,3 +1,12 @@ # Prebuilt APKs are large binaries populated at build time by scripts/collect-apks.sh. # They are reproducible from the Modern-Apps repo, so we don't commit them. prebuilts/*.apk++# Private signing keys. NEVER commit these. generate-keys.sh writes them here or to an+# out-of-tree dir; this guards against an accidental in-repo generation.+keys/*.pk8+keys/*.pem+keys/*.x509.pem+keys/*.bin+*.keystore+*.jks
README.md
diff --git a/README.md b/README.mdindex a115566..4e7fdfa 100644--- a/README.md+++ b/README.md@@ -27,12 +27,18 @@ repo.)  ``` Android.bp                            # android_app_import per app (Files: privileged)-modern_apps.mk                        # PRODUCT_PACKAGES += ours; filter-out stock; overlays; privapp+modern_apps.mk                        # PRODUCT_PACKAGES += ours; filter-out stock; overlays; privapp; branding+maos_branding.mk                      # PRODUCT_* + ro.maos.* identity (inherited by modern_apps.mk) privapp-permissions-modern-apps.xml   # MANAGE_DOCUMENTS for Files-overlay/                              # static frameworks/base overlay-  frameworks/base/core/res/res/values/config.xml   # config_defaultBrowser, config_documentsUiPackage+overlay/                              # static overlays+  frameworks/base/.../config.xml       #   config_defaultBrowser, config_documentsUiPackage+  packages/apps/Updater/.../config.xml #   OTA server URL (verify resource name) prebuilts/                            # release APKs (git-ignored; populated by script) scripts/collect-apks.sh              # copies Modern-Apps release APKs into prebuilts/+keys/generate-keys.sh                # generates the OS key set (offline; never committed)+ota/                                 # build-ota.sh + publish-ota.sh (+ README)+updater/                             # how to point the Updater at ota.ma.vayunmathur.com+docs/BUILD_RUNBOOK.md                # end-to-end Linux build/sign/OTA/publish local_manifest.xml                    # adds this repo to the GrapheneOS tree ``` @@ -55,7 +61,8 @@ local_manifest.xml                    # adds this repo to the GrapheneOS tree    ```bash    vendor/modern-apps/scripts/collect-apks.sh /path/to/Modern-Apps    ```-5. Build, sign with your own keys, and rebrand (you cannot ship as "GrapheneOS").+5. Generate OS signing keys (offline), build, sign, and rebrand — full sequence in+   **[`docs/BUILD_RUNBOOK.md`](docs/BUILD_RUNBOOK.md)**. You cannot ship as "GrapheneOS".  ## Notes @@ -80,6 +87,9 @@ local_manifest.xml                    # adds this repo to the GrapheneOS tree  ## OTA -MAOS uses the standard GrapheneOS/AOSP A/B OTA flow (`update_engine` + a forked/overlaid-Updater pointed at your own signed release server). See the OTA section of-`GRAPHENEOS_FORK_PLAN.md`.+MAOS uses the standard A/B OTA flow (`update_engine`) with updates served from+**`https://ota.ma.vayunmathur.com`**, hosted by `location_share_server` (which proxies the+signed OTA zips + channel metadata from a public GitHub Release — the same pattern as the+F-Droid repo). Build/publish scripts are in [`ota/`](ota/README.md); pointing the Updater+at the server is covered in [`updater/`](updater/README.md). Full design rationale is in+`GRAPHENEOS_FORK_PLAN.md` (Modern-Apps repo).
docs/BUILD_RUNBOOK.md
diff --git a/docs/BUILD_RUNBOOK.md b/docs/BUILD_RUNBOOK.mdnew file mode 100644index 0000000..e008a63--- /dev/null+++ b/docs/BUILD_RUNBOOK.md@@ -0,0 +1,147 @@+# MAOS build runbook (Linux)++End-to-end steps to build, sign, and ship MAOS. **This must run on Linux** (Debian/Ubuntu+recommended), with ~400 GB free disk, 32 GB+ RAM, and a fast connection. It cannot run on+Windows/macOS. Commands assume `bash`.++> Terminology: `$DEVICE` = Pixel codename (e.g. `shusky`), `$BUILD` = build number you+> choose (e.g. `2026080900`), `$KEYSDIR` = your keys dir (e.g. `~/.android-certs`).++---++## 0. One-time host setup++Follow GrapheneOS's official build-environment setup (packages, `repo`, adevtool, etc.).+Do not skip their prerequisites — MAOS is a thin overlay on top of a stock GrapheneOS+build, so if a plain GrapheneOS build works, MAOS will.++## 1. Sync the source + inject the MAOS overlay++```bash+mkdir grapheneos && cd grapheneos+repo init -u https://github.com/GrapheneOS/platform_manifest -b <RELEASE_BRANCH>++# Add the MAOS overlay via a local manifest (no fork of platform_manifest):+mkdir -p .repo/local_manifests+ln -s /path/to/MAOS/local_manifest.xml .repo/local_manifests/modern-apps.xml++repo sync -c -j"$(nproc)"+```++This lands the overlay at `vendor/modern-apps/`.++## 2. Confirm the stock module/project names++Names drift between GrapheneOS releases. Verify the `filter-out` list and (optional)+`<remove-project>` entries match this checkout:++```bash+grep -rn --include=*.mk -e 'Vanadium' -e 'Camera' -e 'PdfViewer' -e 'Apps' \+  -e 'Contacts' -e 'DeskClock' -e 'Calculator' -e 'Gallery2' -e 'DocumentsUI' \+  build/ device/ vendor/+```++Update `vendor/modern-apps/modern_apps.mk` if any differ. The build-time guard in that+file will fail the build if a stock app we meant to drop is still present.++## 3. Inherit the MAOS product config++In your device product makefile (`device/google/<board>/aosp_$DEVICE.mk` or the+GrapheneOS equivalent), **as the last inherit**:++```make+$(call inherit-product, vendor/modern-apps/modern_apps.mk)+```++This adds the 9 Modern Apps, filters out the stock apps, applies the overlays+(`config_defaultBrowser`, `config_documentsUiPackage`, Updater URL), the Files+privapp-permissions allowlist, and MAOS branding.++## 4. Populate the prebuilt APKs++Build the 9 apps from the Modern-Apps repo (or grab a release), then:++```bash+vendor/modern-apps/scripts/collect-apks.sh /path/to/Modern-Apps+```++## 5. Generate signing keys (once)++```bash+source build/envsetup.sh+vendor/modern-apps/keys/generate-keys.sh "$KEYSDIR"+```++Keep `$KEYSDIR` **offline and backed up**. Losing `releasekey`/`avb.pem` permanently+breaks OTA for installed devices.++## 6. Build++```bash+source build/envsetup.sh+lunch aosp_${DEVICE}-user      # or the GrapheneOS target for your device+m target-files-package+```++## 7. Sign++```bash+sign_target_files_apks -o -d "$KEYSDIR" \+  out/target/product/$DEVICE/obj/PACKAGING/target_files_intermediates/*-target_files-*.zip \+  signed-$DEVICE-$BUILD.zip+```++If AVB isn't picked up from `$KEYSDIR`, pass the AVB options explicitly+(`--avb_vbmeta_key`, `--avb_vbmeta_algorithm`, etc.) — see GrapheneOS's signing docs for+your device. Archive `signed-$DEVICE-$BUILD.zip` for future incrementals.++## 8. Produce a flashable factory image (for first install)++Use the standard AOSP `img_from_target_files` / GrapheneOS factory-image script on the+signed target-files, then flash via fastboot as usual.++## 9. Generate + publish OTA++```bash+# Full (and optional incremental from the previous signed target-files):+vendor/modern-apps/ota/build-ota.sh \+  -d "$DEVICE" -b "$BUILD" -c stable -k "$KEYSDIR" \+  -t signed-$DEVICE-$BUILD.zip \+  [-p signed-$DEVICE-$OLD_BUILD.zip -o "$OLD_BUILD"]++# Publish to the PUBLIC OTA repo (server proxies its latest release):+vendor/modern-apps/ota/publish-ota.sh -r vayun-mathur/MAOS-releases -t "$BUILD"+```++Make sure the server's `MAOS_OTA_GH` matches the repo you publish to.++## 10. Wire the OTA server++On the box running `location_share_server`, point DNS `ota.ma.vayunmathur.com` at it and+ensure its TLS cert covers that host. The server already routes that host to the OTA+proxy (`handlers/ota.rs`). No code change needed beyond deploying the updated binary.++## 11. Test before trusting it++- **Sideload the full OTA** in recovery: `adb sideload <device>-ota_update-$BUILD.zip`+  (validates signing + `otacerts.zip` end to end).+- **In-app update**: install an older build, then let the Updater fetch from+  `ota.ma.vayunmathur.com`.+- **Incremental**: test specifically from the previous build (deltas fail differently+  than full OTAs).+- **Key isolation**: confirm a MAOS-signed device rejects a GrapheneOS OTA and vice+  versa.++---++## De-branding checklist (Part of "cannot ship as GrapheneOS")++`maos_branding.mk` covers build.prop identity. Also overlay the user-visible strings:++```bash+grep -rn "GrapheneOS" packages/apps/Settings/ device/ vendor/ | grep -i string+```++Overlay the "About phone" / Settings strings and swap boot logo/wallpaper assets under+`vendor/modern-apps/overlay/` for the relevant packages. Attestation (Auditor) is pinned+to GrapheneOS's keys/server and won't pass under a fork — disable or self-host it.
keys/generate-keys.sh
diff --git a/keys/generate-keys.sh b/keys/generate-keys.shnew file mode 100755index 0000000..883c251--- /dev/null+++ b/keys/generate-keys.sh@@ -0,0 +1,71 @@+#!/usr/bin/env bash+#+# generate-keys.sh — create the MAOS signing key set on the (offline) build host.+#+# These are the OS keys, entirely separate from the app signing keys: the 9 Modern+# Apps ship `presigned` and keep their own com.vayunmathur certificate, so app updates+# via the app store keep working. Do NOT reuse an app key here, and do NOT reuse these+# for apps (a platform-signed app would be massively over-privileged).+#+# >>> The generated files are PRIVATE KEYS. Keep them OFFLINE, back them up, and NEVER+# >>> commit them. This repo's .gitignore excludes keys/*, but be careful anyway.+#+# Usage:+#   source build/envsetup.sh            # sets ANDROID_BUILD_TOP, adds avbtool to PATH+#   vendor/modern-apps/keys/generate-keys.sh ~/.android-certs ["/C=US/ST=.../CN=MAOS/..."]+#+set -euo pipefail++OUT="${1:?usage: generate-keys.sh <output-dir> [x509-subject]}"+SUBJECT="${2:-/C=US/ST=California/L=Burlingame/O=MAOS/OU=MAOS/CN=MAOS/[email protected]}"++: "${ANDROID_BUILD_TOP:?run 'source build/envsetup.sh' in the AOSP tree first}"+MAKE_KEY="$ANDROID_BUILD_TOP/development/tools/make_key"+[[ -x "$MAKE_KEY" ]] || { echo "make_key not found at $MAKE_KEY" >&2; exit 1; }+command -v avbtool >/dev/null || { echo "avbtool not on PATH (source envsetup.sh / lunch)" >&2; exit 1; }++mkdir -p "$OUT"+cd "$OUT"++# The AOSP APK-signing key set. releasekey also signs the OTA payloads.+# platform/shared/media are classic; networkstack (A10+), sdk_sandbox (A14+) and+# bluetooth (A13+) are required by newer platforms — generating extras is harmless.+KEYS=(releasekey platform shared media networkstack sdk_sandbox bluetooth)++for k in "${KEYS[@]}"; do+    if [[ -f "$k.pk8" ]]; then+        echo "skip $k (already exists)"+        continue+    fi+    echo "generating $k ..."+    # Empty passphrase (piped) => unencrypted keys suitable for automated signing.+    # For encrypted keys, run make_key interactively and keep the passphrases in a+    # secrets manager the release job can read.+    echo | "$MAKE_KEY" "$k" "$SUBJECT"+done++# Verified Boot (AVB) key: RSA-4096 private key + its public-key metadata blob that+# gets embedded in vbmeta. Wired into the build via BOARD_AVB_* / the signing step+# (see docs/BUILD_RUNBOOK.md).+if [[ ! -f avb.pem ]]; then+    echo "generating avb.pem (RSA-4096) ..."+    openssl genrsa -out avb.pem 4096+    avbtool extract_public_key --key avb.pem --output avb_pkmd.bin+else+    echo "skip avb.pem (already exists)"+fi++chmod 600 ./*.pk8 ./*.pem 2>/dev/null || true++cat <<EOF++Done. Key set written to: $OUT+  APK/OTA keys : ${KEYS[*]} (.pk8 + .x509.pem each)+  AVB          : avb.pem (private) + avb_pkmd.bin (public metadata)++Next:+  * Keep this directory OFFLINE and backed up. Losing releasekey/avb bricks OTA updates+    for every installed device (they can only accept updates signed by the same keys).+  * Never commit these files.+  * See docs/BUILD_RUNBOOK.md for wiring them into the build + signing + OTA steps.+EOF
maos_branding.mk
diff --git a/maos_branding.mk b/maos_branding.mknew file mode 100644index 0000000..92c44ff--- /dev/null+++ b/maos_branding.mk@@ -0,0 +1,26 @@+# MAOS branding — inherited from modern_apps.mk.+#+# You cannot ship as "GrapheneOS"; this rebrands the build as MAOS (Modern Apps OS).+# Full de-branding also requires overlaying the Settings "About phone" strings and+# swapping boot logos/wallpapers — those live under overlay/ and are called out in+# docs/BUILD_RUNBOOK.md. This file covers the build.prop-level identity.+#+# NOTE: changing brand/fingerprint means the build no longer matches GrapheneOS's+# attestation/OTA identity — expected for a fork. Because MAOS is self-signed, Play+# Integrity / stock attestation won't pass regardless; see the runbook.++PRODUCT_BRAND := MAOS+PRODUCT_MANUFACTURER := MAOS++# Marketing/version identity surfaced to our own apps (e.g. the Updater) and About.+# Keep MAOS_VERSION in sync with the OTA build number used by ota/build-ota.sh.+MAOS_VERSION ?= 1+MAOS_CHANNEL ?= stable++PRODUCT_PRODUCT_PROPERTIES += \+    ro.maos.version=$(MAOS_VERSION) \+    ro.maos.channel=$(MAOS_CHANNEL) \+    ro.maos.ota.server=https://ota.ma.vayunmathur.com++# Do NOT set ro.build.tags=test-keys — we sign with our own release keys, so this must+# remain release-keys (handled by the release signing step, not here).
modern_apps.mk
diff --git a/modern_apps.mk b/modern_apps.mkindex 3c99bd9..394496b 100644--- a/modern_apps.mk+++ b/modern_apps.mk@@ -52,7 +52,10 @@ PRODUCT_PACKAGE_OVERLAYS += vendor/modern-apps/overlay PRODUCT_COPY_FILES += \     vendor/modern-apps/privapp-permissions-modern-apps.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-modern-apps.xml -# 5. Build-time guard: fail the build if any stock app we meant to drop is still in+# 5. MAOS branding (PRODUCT_* + ro.maos.* props). Kept separate for readability.+$(call inherit-product-if-exists, vendor/modern-apps/maos_branding.mk)++# 6. Build-time guard: fail the build if any stock app we meant to drop is still in #    PRODUCT_PACKAGES (catches upstream module renames that would silently re-add it). _maos_leaked := $(filter Camera PdfViewer Apps Contacts DeskClock Calculator Gallery2 DocumentsUI,$(PRODUCT_PACKAGES)) ifneq ($(_maos_leaked),)
ota/README.md
diff --git a/ota/README.md b/ota/README.mdnew file mode 100644index 0000000..9e97d2b--- /dev/null+++ b/ota/README.md@@ -0,0 +1,49 @@+# MAOS OTA++How over-the-air updates flow, and the scripts that produce them.++## Pipeline++```+signed target-files ──build-ota.sh──▶ full + incremental OTA zips + channel metadata+        │                                          │+        │                                          ▼+        │                               publish-ota.sh ──▶ PUBLIC GitHub Release (latest)+        │                                                          │+        ▼                                                          ▼+  (kept for next                              ota.ma.vayunmathur.com proxies+   incremental)                               /latest/download/<file>  (location_share_server)+                                                                   │+                                                                   ▼+                                                        Updater on device+```++- **`build-ota.sh`** turns a *signed* target-files zip into `DEVICE-ota_update-BUILD.zip`+  (full), optionally `DEVICE-incremental-OLD-NEW.zip`, and a `DEVICE-CHANNEL` metadata+  file. Signed with your `releasekey`.+- **`publish-ota.sh`** uploads those to a **public** GitHub Release marked *latest*.+- **`location_share_server`** (`handlers/ota.rs`) serves `https://ota.ma.vayunmathur.com/<file>`+  by streaming from `releases/latest/download/<file>` of that repo. Set `MAOS_OTA_GH` on+  the server to the repo you publish to (defaults to `vayun-mathur/MAOS`).+- The **Updater** app polls `https://ota.ma.vayunmathur.com/<device>-<channel>` then+  downloads the referenced zip (see `../updater/README.md`).++## Keep every release's signed target-files++Incrementals diff the previous signed target-files against the new one. Archive each+release's `signed-*.zip` so you can pass it as `-p` next time. Without it you can still+ship a full OTA, just not a delta.++## Metadata format++`build-ota.sh` writes `BUILD TIMESTAMP CHANNEL` (one line). This must match whatever your+Updater version parses — confirm against the pinned source and adjust both sides+together if needed.++## Payloads are proxied, not stored++Nothing is stored on the OTA host; it streams from GitHub Releases (mirrors how the+F-Droid repo proxies APKs). The release repo must be **public** so the server can fetch+without auth (or run the server with a token and keep it private).++See `../docs/BUILD_RUNBOOK.md` for the full build → sign → OTA → publish sequence.
ota/build-ota.sh
diff --git a/ota/build-ota.sh b/ota/build-ota.shnew file mode 100755index 0000000..d661947--- /dev/null+++ b/ota/build-ota.sh@@ -0,0 +1,83 @@+#!/usr/bin/env bash+#+# build-ota.sh — generate signed OTA package(s) + channel metadata from a SIGNED+# target-files zip.+#+# Prerequisite: you already produced a signed target-files with your MAOS keys, e.g.+#+#   sign_target_files_apks -o -d "$KEYSDIR" \+#     out/target/product/$DEVICE/obj/PACKAGING/target_files_intermediates/*-target_files-*.zip \+#     signed-$DEVICE-$BUILD.zip+#+# (see docs/BUILD_RUNBOOK.md). This script turns that into a full OTA, an optional+# incremental OTA, and the tiny channel-metadata file the Updater polls.+#+# Run inside the AOSP tree after `source build/envsetup.sh` so ota_from_target_files is+# on PATH (else it's at build/make/tools/releasetools/ota_from_target_files).+#+set -euo pipefail++DEVICE="" ; CHANNEL="stable" ; BUILD="" ; SIGNED_TF="" ; PREV_TF="" ; OLD_BUILD=""+KEYSDIR="" ; OUTDIR="out/maos-ota"++usage() {+    cat >&2 <<EOF+usage: build-ota.sh -d DEVICE -b BUILD -t SIGNED_TF -k KEYSDIR [options]+  -d DEVICE       device codename (e.g. shusky)+  -b BUILD        build number for the new build (e.g. 2026080900)+  -t SIGNED_TF    signed target-files zip for the new build+  -k KEYSDIR      dir holding releasekey.{pk8,x509.pem} (OTA signing key)+  -c CHANNEL      release channel (default: stable)+  -p PREV_TF      previous signed target-files (to also build an incremental)+  -o OLD_BUILD    previous build number (required with -p; used in the file name)+  -O OUTDIR       output dir (default: out/maos-ota)+EOF+    exit 2+}++while getopts "d:b:t:k:c:p:o:O:h" opt; do+    case "$opt" in+        d) DEVICE="$OPTARG" ;;+        b) BUILD="$OPTARG" ;;+        t) SIGNED_TF="$OPTARG" ;;+        k) KEYSDIR="$OPTARG" ;;+        c) CHANNEL="$OPTARG" ;;+        p) PREV_TF="$OPTARG" ;;+        o) OLD_BUILD="$OPTARG" ;;+        O) OUTDIR="$OPTARG" ;;+        *) usage ;;+    esac+done++[[ -n "$DEVICE" && -n "$BUILD" && -n "$SIGNED_TF" && -n "$KEYSDIR" ]] || usage+[[ -f "$SIGNED_TF" ]] || { echo "signed target-files not found: $SIGNED_TF" >&2; exit 1; }+[[ -f "$KEYSDIR/releasekey.pk8" ]] || { echo "releasekey not found in $KEYSDIR" >&2; exit 1; }+if [[ -n "$PREV_TF" && -z "$OLD_BUILD" ]]; then echo "-p requires -o OLD_BUILD" >&2; exit 1; fi++OTA_TOOL="ota_from_target_files"+command -v "$OTA_TOOL" >/dev/null || \+    OTA_TOOL="${ANDROID_BUILD_TOP:?source build/envsetup.sh}/build/make/tools/releasetools/ota_from_target_files"++mkdir -p "$OUTDIR"++FULL="$OUTDIR/$DEVICE-ota_update-$BUILD.zip"+echo ">> full OTA -> $FULL"+"$OTA_TOOL" -k "$KEYSDIR/releasekey" "$SIGNED_TF" "$FULL"++if [[ -n "$PREV_TF" ]]; then+    [[ -f "$PREV_TF" ]] || { echo "previous target-files not found: $PREV_TF" >&2; exit 1; }+    INC="$OUTDIR/$DEVICE-incremental-$OLD_BUILD-$BUILD.zip"+    echo ">> incremental OTA ($OLD_BUILD -> $BUILD) -> $INC"+    "$OTA_TOOL" -k "$KEYSDIR/releasekey" -i "$PREV_TF" "$SIGNED_TF" "$INC"+fi++# Channel metadata polled by the Updater at+#   https://ota.ma.vayunmathur.com/$DEVICE-$CHANNEL+# Format: "BUILD TIMESTAMP CHANNEL". Keep this in sync with what your Updater fork+# parses (see updater/README.md).+META="$OUTDIR/$DEVICE-$CHANNEL"+printf '%s %s %s\n' "$BUILD" "$(date +%s)" "$CHANNEL" > "$META"+echo ">> metadata -> $META ($(cat "$META"))"++echo+echo "Artifacts in $OUTDIR — publish with ota/publish-ota.sh"
ota/publish-ota.sh
diff --git a/ota/publish-ota.sh b/ota/publish-ota.shnew file mode 100755index 0000000..cb8471c--- /dev/null+++ b/ota/publish-ota.sh@@ -0,0 +1,57 @@+#!/usr/bin/env bash+#+# publish-ota.sh — upload OTA artifacts to a PUBLIC GitHub Release so the OTA server+# (ota.ma.vayunmathur.com) can proxy them from `.../releases/latest/download/<file>`.+#+# The server serves whatever is on the LATEST release, so this marks the release latest.+# Devices download from our origin (the server proxies the bytes), never from GitHub+# directly, so a redirect-averse Updater still works.+#+# Requires the GitHub CLI (`gh`) authenticated with write access to the OTA repo.+#+# Usage:+#   ota/publish-ota.sh -r vayun-mathur/MAOS-releases -t 2026080900 -O out/maos-ota+#+set -euo pipefail++REPO="" ; TAG="" ; OUTDIR="out/maos-ota"++usage() {+    cat >&2 <<EOF+usage: publish-ota.sh -r OWNER/REPO -t TAG [-O OUTDIR]+  -r OWNER/REPO   PUBLIC GitHub repo to hold OTA releases (must match the server's+                  MAOS_OTA_GH; defaults there to vayun-mathur/MAOS)+  -t TAG          release tag (e.g. the build number 2026080900)+  -O OUTDIR       dir containing the artifacts from build-ota.sh (default: out/maos-ota)+EOF+    exit 2+}++while getopts "r:t:O:h" opt; do+    case "$opt" in+        r) REPO="$OPTARG" ;;+        t) TAG="$OPTARG" ;;+        O) OUTDIR="$OPTARG" ;;+        *) usage ;;+    esac+done++[[ -n "$REPO" && -n "$TAG" ]] || usage+command -v gh >/dev/null || { echo "gh (GitHub CLI) not found" >&2; exit 1; }+shopt -s nullglob+FILES=("$OUTDIR"/*.zip "$OUTDIR"/*-stable "$OUTDIR"/*-beta)+[[ ${#FILES[@]} -gt 0 ]] || { echo "no artifacts in $OUTDIR" >&2; exit 1; }++echo ">> publishing ${#FILES[@]} file(s) to $REPO @ $TAG (latest)"+if gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1; then+    gh release upload "$TAG" "${FILES[@]}" --repo "$REPO" --clobber+    gh release edit "$TAG" --repo "$REPO" --latest+else+    gh release create "$TAG" "${FILES[@]}" \+        --repo "$REPO" \+        --title "MAOS OTA $TAG" \+        --notes "Automated MAOS OTA release." \+        --latest+fi++echo ">> done. Server will serve these from https://ota.ma.vayunmathur.com/<file>"
overlay/packages/apps/Updater/res/values/config.xml
diff --git a/overlay/packages/apps/Updater/res/values/config.xml b/overlay/packages/apps/Updater/res/values/config.xmlnew file mode 100644index 0000000..1b7be5f--- /dev/null+++ b/overlay/packages/apps/Updater/res/values/config.xml@@ -0,0 +1,19 @@+<?xml version="1.0" encoding="utf-8"?>+<!--+  Overlay for the GrapheneOS Updater's OTA server URL.++  !!! VERIFY THE RESOURCE NAME against your pinned Updater source before relying on this.+  Overlays only replace a resource that already exists with the SAME name; if the name is+  wrong this file does nothing (and does not fail the build). Find the real name with:++      grep -rn "releases.grapheneos.org" packages/apps/Updater/++  If the URL lives in code / BuildConfig instead of resources, overlaying can't help —+  fork the Updater and change it there (see updater/README.md).++  This overlay is wired in via PRODUCT_PACKAGE_OVERLAYS (vendor/modern-apps/overlay).+-->+<resources>+    <!-- Common GrapheneOS name is "url"; adjust to match your source if different. -->+    <string name="url" translatable="false">https://ota.ma.vayunmathur.com</string>+</resources>
scripts/collect-apks.sh
diff --git a/scripts/collect-apks.sh b/scripts/collect-apks.shold mode 100644new mode 100755
updater/README.md
diff --git a/updater/README.md b/updater/README.mdnew file mode 100644index 0000000..61000d4--- /dev/null+++ b/updater/README.md@@ -0,0 +1,54 @@+# Updater configuration (MAOS)++MAOS reuses the GrapheneOS Updater app but points it at our own OTA server,+`https://ota.ma.vayunmathur.com` (served by `location_share_server`, which proxies the+metadata + signed OTA zips from the latest GitHub Release — see that repo's+`handlers/ota.rs`).++## What the Updater fetches++For device `$DEVICE` on channel `$CHANNEL` (e.g. `stable`), it requests:++- **Metadata:** `GET https://ota.ma.vayunmathur.com/$DEVICE-$CHANNEL`+- **Full OTA:** `GET https://ota.ma.vayunmathur.com/$DEVICE-ota_update-$BUILD.zip`+- **Incremental:** `GET https://ota.ma.vayunmathur.com/$DEVICE-incremental-$OLD-$NEW.zip`++Those filenames are produced by `ota/build-ota.sh` and uploaded to the release by+`ota/publish-ota.sh`. The metadata line format is defined there and must match whatever+your Updater version parses (GrapheneOS uses a short space-separated line —+`BUILD TIMESTAMP CHANNEL` in our `build-ota.sh`).++## Two things to change in the Updater++1. **Server URL.** GrapheneOS hardcodes `https://releases.grapheneos.org`. Find it and+   replace it with `https://ota.ma.vayunmathur.com`:++   ```bash+   grep -rn "releases.grapheneos.org" packages/apps/Updater/+   ```++   If it resolves to a **string resource**, prefer overlaying it (no fork) — see+   `overlay/` below. If it's a `const`/`BuildConfig` value in code, you need a small+   fork of `packages/apps/Updater` (pull it in via the local manifest; see the main+   fork plan's "fallback: when a real fork is unavoidable").++2. **Certificate pinning.** GrapheneOS pins its server's certificate. `ota.ma.vayunmathur.com`+   uses a normal (Let's Encrypt) certificate, so either remove the pin or repin to your+   cert. Check the Updater's `network_security_config` / any `CertificatePinner`:++   ```bash+   grep -rn "pin-set\|CertificatePinner\|network_security_config" packages/apps/Updater/+   ```++## Overlay (preferred, if the URL is a resource)++`overlay/packages/apps/Updater/res/values/config.xml` in this repo overlays the server+URL. **Verify the string name** against your pinned Updater source before relying on it+— an overlay with the wrong resource name silently does nothing (it won't fail the+build). Update the name to match, then confirm the built Updater points at+`ota.ma.vayunmathur.com`.++## Channels++`build-ota.sh` publishes per-channel metadata (`$DEVICE-stable`, `$DEVICE-beta`, ...).+Keep the channel names the Updater offers in sync with the ones you publish.