openclaw/scripts/lib/mac-app-bundle.sh
Peter Steinberger dd4528b639
fix(macos): pair app builds with verified node workers (#131466)
Pair packaged apps with complete private arm64 and x86_64 workers whose full build identity matches the app. Preserve independently managed Gateways and complete recognized native-first state through the canonical initializer. Verify emitted-SDK filesystem calls, native capabilities, readiness and shutdown before app publication.

Derive elevation payloads without modifying canonical installed inputs. Preserve universal slices, resources and contained links; reject incomplete, malformed, escaping or mismatched payloads. Reuse descriptor-bound native inventory for signing while retaining the portable installer's independent distribution contract and every Foundation identity, entitlement, notarization and architecture gate.

Use the existing pinned-pnpm package path, including Corepack-only builders, and avoid recursive app-glob expansion. Centralize Mac CI ownership. Carry invocation-owned Git lock cleanup into main's canonical Git owner and regenerate its workflow projection, retaining lifetime fencing and pre-existing/junction-linked locks.

Fix the Android refresh race exposed by CI by removing the redundant reconnect after connect already replaces each role's socket. Preserve authentication, scopes and physical connection leases, with a controlled real-WebSocket regression.

Closes #131459
2026-08-29 14:47:55 -07:00

21 lines
629 B
Bash

#!/usr/bin/env bash
# Both direct packaging and restart publish only a completely verified bundle.
replace_mac_app_bundle() {
local staged="$1" target="$2" previous
previous="$(mktemp -d "${target}.previous.XXXXXX")" || return 1
if [[ -e "$target" ]]; then
mv "$target" "$previous/OpenClaw.app" || return 1
fi
if ! mv "$staged" "$target"; then
if [[ -e "$previous/OpenClaw.app" ]]; then
mv "$previous/OpenClaw.app" "$target" || {
echo "ERROR: Restore the previous app from $previous/OpenClaw.app" >&2
return 1
}
fi
rmdir "$previous"
return 1
fi
rm -rf "$previous"
}