From 9fc82fb7d87a05753e116a0efedaa867fa0d5ad3 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Wed, 11 Nov 2026 14:59:02 +0200 Subject: [PATCH] Harden prepare-release.sh beatles boot validation and archive creation - Normalize target aliases and decouple boot-lk2nd-nokia-beatles-display.img rebuilds from rebuild-image.sh so a missing lk2nd image does not rebuild the verified raw image - Run check-beatles-bootimg.py, sync-beatles-bootfs.py --check, and display_lk2nd_is_current before archiving nokia-beatles - Remove pre-existing release directories and .zip files before packing both boot-bananarchy-nokia-beatles.img and boot-lk2nd-nokia-beatles-display.img, and guard in check-rebuild.sh --- CHANGELOG.md | 2 +- prepare-release.sh | 33 ++++++++++++++++++++++++++------- scripts/check-rebuild.sh | 12 ++++++++++++ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36449ab..96ba6a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ This build contains all previously unreleased 2720 Flip (`nokia-beatles`) change - **Audit findings**: auditing every change since `a1108` (`8448b6465f7f`) showed that `dwm` already isolates flip vs slider behaviour through `/usr/share/bananarchy/lid-profile` (`is_flip_profile()`), keeping exposed top-row keypad input, 60 ms `SW_LID` close locking (`HANGUP_CLOSE` + `locker screenoff`), and `SW_LID=0` / `SW_KEYPAD_SLIDE=1` wake-to-lockscreen identical to `a1108` when `lid-profile` is `slider`. However, `overlay/rootfs/usr/share/bananarchy/lid-profile` was hardcoded to `flip`, `etc/runlevels/default/bananarchy-{lid,cover-display,volume-keys}` and mux `modules-load.d` entries were left enabled on non-flip builds, `bananarchy-x11-session.sh` sent `Escape` 3 s after boot even when `/tmp/bananarchy_screen_locked` was set (which blanks an active `xlocker` on `nokia-argon`), and `bananarchy-display-power-sync`, `locker.so`, and `callscreen.so` checked `/run/bananarchy/lid-state` without checking `lid-profile`. - **Switch**: `scripts/apply-bananarchy-overlay.sh` now writes `/usr/share/bananarchy/lid-profile` per target (`slider` on `nokia-argon`, `flip` on `nokia-beatles`, `none` on `nokia-tough`/`nokia-sparkler`/`nokia-leo`), removes stale top-level `/boot/qcom-*.dtb` files when switching targets, and strips `etc/runlevels/default/bananarchy-{lid,cover-display,volume-keys}`, `72-nokia-beatles-cover.rules`, `cover-display.conf`, and `spidev`/`mux-*`/`spi-mux` module loads on non-flip targets. `10-bananarchy-hardware.start`, the `bananarchy-lid` / `bananarchy-volume-keys` / `bananarchy-cover-display` init scripts, and the compiled `bananarchy-lid`, `bananarchy-volume-keys`, and `bananarchy-cover-idle` C daemons (`is_non_flip_profile()`) exit `0` immediately on `slider`/`none` profiles. `bananarchy-x11-session.sh` skips its 3 s stale-grab `Escape` cleanup while `/tmp/bananarchy_screen_locked` exists, `bananarchy-display-power-sync` fast-paths non-flip devices to pure single-panel DPMS + `schedutil` sync, and `locker.so` / `callscreen.so` gate `/run/bananarchy/lid-state` checks on `lid-profile == "flip"`. -- **Image persistence**: rebuilt both `images/bananarchy-nokia-argon.img` (SHA-256 `a93f0dc5a87d30b9084fcc8df97c78e7496ca1564e4855efe12e4696387a7d4d`) and `images/bananarchy-nokia-beatles.img` (SHA-256 `7e1a24270e25beedcbc92b3fc8b7f2b314e3c7a9bf7a8e2dbffae1754d1b74c7`, with standalone `images/boot-bananarchy-nokia-beatles.img` SHA-256 `4b190404e8e9b53955a87ff211e0f706e51d08e4df11689cfa5586422e65763d` and unchanged display lk2nd `b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d`) at `a1111` / `lennon` with `--mkinitfs`, pinned in `scripts/check-rebuild.sh`. `e2fsck -fn` and `debugfs` verified both partitions of both images (`lid-profile = slider` with zero flip services/rules/configs on `nokia-argon`; `lid-profile = flip` with full cover/lid stack on `nokia-beatles`). +- **Image persistence and release packaging**: rebuilt both `images/bananarchy-nokia-argon.img` (SHA-256 `a93f0dc5a87d30b9084fcc8df97c78e7496ca1564e4855efe12e4696387a7d4d`) and `images/bananarchy-nokia-beatles.img` (SHA-256 `7e1a24270e25beedcbc92b3fc8b7f2b314e3c7a9bf7a8e2dbffae1754d1b74c7`, with standalone `images/boot-bananarchy-nokia-beatles.img` SHA-256 `4b190404e8e9b53955a87ff211e0f706e51d08e4df11689cfa5586422e65763d` and unchanged display lk2nd `b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d`) at `a1111` / `lennon` with `--mkinitfs`, pinned in `scripts/check-rebuild.sh`. `e2fsck -fn` and `debugfs` verified both partitions of both images (`lid-profile = slider` with zero flip services/rules/configs on `nokia-argon`; `lid-profile = flip` with full cover/lid stack on `nokia-beatles`). `prepare-release.sh` now normalizes target aliases, decouples `boot-lk2nd-nokia-beatles-display.img` rebuilds from `rebuild-image.sh`, validates `check-beatles-bootimg.py` and `sync-beatles-bootfs.py --check` before zipping, and removes stale `${RELDIR}.zip` archives before packing both `boot-bananarchy-nokia-beatles.img` and `boot-lk2nd-nokia-beatles-display.img`. ### Active-high shared cover backlight, active-black internal isolation and shared blank timeout diff --git a/prepare-release.sh b/prepare-release.sh index 29a0310..77cfd64 100755 --- a/prepare-release.sh +++ b/prepare-release.sh @@ -2,12 +2,25 @@ # Release archive builder for Bananarchy set -eu -BA_TARGET="${1:-nokia-argon}" +RAW_TARGET="${1:-nokia-argon}" +case "$RAW_TARGET" in + nokia-argon|argon) BA_TARGET="nokia-argon" ;; + nokia-beatles|beatles) BA_TARGET="nokia-beatles" ;; + nokia-tough|nokia-coconut|tough|coconut) BA_TARGET="nokia-tough" ;; + nokia-sparkler|sparkler) BA_TARGET="nokia-sparkler" ;; + nokia-leo|leo) BA_TARGET="nokia-leo" ;; + *) + echo "Usage: $0 [nokia-argon|nokia-beatles|nokia-tough|nokia-sparkler|nokia-leo]" >&2 + exit 1 + ;; +esac + BA_REBUILD="${BA_REBUILD:-0}" BA_VER="$(./scripts/version.sh --print)" BA_CODENAME="$(./scripts/version.sh --print-codename)" RELDIR="bananarchy-${BA_TARGET}-${BA_VER}-${BA_CODENAME}" DISPLAY_IMAGE="images/boot-lk2nd-nokia-beatles-display.img" +BOOT_IMAGE="images/boot-bananarchy-nokia-beatles.img" display_lk2nd_is_current() { python3 scripts/check-lk2nd-beatles.py \ @@ -20,10 +33,8 @@ NEED_REBUILD=0 if [ ! -f "images/bananarchy-${BA_TARGET}.img" ]; then NEED_REBUILD=1 fi -if [ "$BA_TARGET" = "nokia-beatles" ]; then - for f in images/boot-bananarchy-nokia-beatles.img "$DISPLAY_IMAGE"; do - [ -f "$f" ] || NEED_REBUILD=1 - done +if [ "$BA_TARGET" = "nokia-beatles" ] && [ ! -f "$BOOT_IMAGE" ]; then + NEED_REBUILD=1 fi if [ "$BA_REBUILD" = "1" ] || [ "$NEED_REBUILD" = "1" ]; then @@ -31,16 +42,24 @@ if [ "$BA_REBUILD" = "1" ] || [ "$NEED_REBUILD" = "1" ]; then fi # The default 2720 lk2nd image must contain the low-bit reboot cookie, or -# "Reboot to loader" cannot return to the visible Fastboot menu. +# "Reboot to loader" cannot return to the visible Fastboot menu. Rebuild it +# separately so a missing lk2nd binary does not invalidate a verified raw image. if [ "$BA_TARGET" = "nokia-beatles" ] && \ { [ "$BA_REBUILD" = "1" ] || ! display_lk2nd_is_current; }; then ./scripts/build-lk2nd-beatles.sh fi +if [ "$BA_TARGET" = "nokia-beatles" ]; then + python3 scripts/check-beatles-bootimg.py + python3 scripts/sync-beatles-bootfs.py --check --raw-image "images/bananarchy-${BA_TARGET}.img" + display_lk2nd_is_current +fi + +rm -rf "$RELDIR" "${RELDIR}.zip" mkdir -p "$RELDIR" cp "images/bananarchy-${BA_TARGET}.img" "$RELDIR/" if [ "$BA_TARGET" = "nokia-beatles" ]; then - cp images/boot-bananarchy-nokia-beatles.img "$RELDIR/" + cp "$BOOT_IMAGE" "$RELDIR/" cp "$DISPLAY_IMAGE" "$RELDIR/" else cp bootloader/lk2nd-msm8909.img "$RELDIR/" diff --git a/scripts/check-rebuild.sh b/scripts/check-rebuild.sh index 39d0b77..9eb98bb 100755 --- a/scripts/check-rebuild.sh +++ b/scripts/check-rebuild.sh @@ -803,6 +803,18 @@ if grep -q -- '--debug-boot' "$BASE_DIR/flash-edl.py" || \ fail "flash-edl.py still references the abandoned debug boot image" fi +PREPARE_REL="$BASE_DIR/prepare-release.sh" +if ! grep -qF 'DISPLAY_IMAGE="images/boot-lk2nd-nokia-beatles-display.img"' "$PREPARE_REL" || \ + ! grep -qF 'BOOT_IMAGE="images/boot-bananarchy-nokia-beatles.img"' "$PREPARE_REL" || \ + ! grep -qF 'cp "$BOOT_IMAGE" "$RELDIR/"' "$PREPARE_REL" || \ + ! grep -qF 'cp "$DISPLAY_IMAGE" "$RELDIR/"' "$PREPARE_REL" || \ + ! grep -qF 'python3 scripts/check-beatles-bootimg.py' "$PREPARE_REL" || \ + ! grep -qF 'python3 scripts/sync-beatles-bootfs.py --check' "$PREPARE_REL" || \ + ! grep -qF 'rm -rf "$RELDIR" "${RELDIR}.zip"' "$PREPARE_REL" || \ + grep -qF 'for f in images/boot-bananarchy-nokia-beatles.img "$DISPLAY_IMAGE"' "$PREPARE_REL"; then + fail "prepare-release.sh lost decoupled beatles boot/lk2nd validation or clean zip replacement" +fi + echo "[check] Plugin artifacts..." for source in "$BASE_DIR"/src/dwm-plugins/*_plugin.cpp; do name="$(basename "$source" _plugin.cpp)"