Repository Public License
1#!/usr/bin/env bash2# ORIX OS Automation3# File: Scripts/release/sign.sh4# Description: Verifies the Developer ID signature, Hardened Runtime, timestamp and entitlements of dist/ORIX OS Automation.app. Signing itself is done by Xcode in the Release build.5#6# Author: Simon-Pierre Boucher7# Contact: contact@spboucher.ai8set -euo pipefail9cd "$(dirname "$0")/../.."10APP="dist/ORIX OS Automation.app"11[[ -d "$APP" ]] || { echo "ERROR: $APP not found. Run Scripts/build/build.sh release first." >&2; exit 1; }12INFO="$(codesign -dvv "$APP" 2>&1)"13fail() { echo "FAIL: $1" >&2; exit 1; }14grep -q "^Authority=Developer ID Application: " <<<"$INFO" || fail "not signed with a Developer ID Application identity"15grep -q "flags=.*runtime" <<<"$INFO" || fail "Hardened Runtime is not enabled"16grep -q "^Timestamp=" <<<"$INFO" || fail "no secure timestamp"17grep -q "^Identifier=ai.spboucher.orix.automation$" <<<"$INFO" || fail "unexpected bundle identifier"18codesign --verify --deep --strict "$APP" || fail "signature does not verify"19ENT="$(codesign -d --entitlements - --xml "$APP" 2>/dev/null | plutil -p - 2>/dev/null || true)"20if grep -q "get-task-allow" <<<"$ENT"; then fail "get-task-allow entitlement present (debug entitlement in a release build)"; fi21echo "Signature : $(sed -n 's/^Authority=\(Developer ID Application: .*\)$/\1/p' <<<"$INFO" | head -1)"22echo "Team : $(sed -n 's/^TeamIdentifier=//p' <<<"$INFO")"23echo "Runtime : hardened ($(sed -n 's/^.*flags=\(.*\) hashes.*$/\1/p' <<<"$INFO"))"24echo "Timestamp : $(sed -n 's/^Timestamp=//p' <<<"$INFO")"25echo "Entitlements: ${ENT:-none}"26echo "OK: signature verified."27