Repository Public
1#!/bin/bash2# Submits a file (.zip or .dmg) to the Apple notary service with the keychain profile "MacLustr-Notarize" and waits.3# Scripts/notarize.sh <file> [result.json]4# On rejection, the notary log is fetched and printed.5set -euo pipefail6FILE="$1"7OUT="${2:-/dev/null}"8PROFILE="${MCC_NOTARY_PROFILE:-MacLustr-Notarize}"9RESULT="$(xcrun notarytool submit "$FILE" --keychain-profile "$PROFILE" --wait --output-format json)"10echo "$RESULT" > "$OUT"11ID="$(echo "$RESULT" | plutil -extract id raw - 2>/dev/null || true)"12STATUS="$(echo "$RESULT" | plutil -extract status raw - 2>/dev/null || true)"13echo "notarization: id=$ID status=$STATUS file=$(basename "$FILE")"14if [ "$STATUS" != "Accepted" ]; then15 [ -n "$ID" ] && xcrun notarytool log "$ID" --keychain-profile "$PROFILE" || true16 exit 117fi18