33 lines
1.6 KiB
Bash
33 lines
1.6 KiB
Bash
#!/bin/bash
|
|||
|
|
# Run explicitly once for a downloaded, ad-hoc signed standalone build.
|
||
|
|
set -euo pipefail
|
||
|
|
cd "$(dirname "$0")"
|
||
|
|
app=""
|
||
|
|
for candidate in ./*.app; do
|
||
|
|
[[ -d "$candidate" ]] || continue
|
||
|
|
identifier=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$candidate/Contents/Info.plist" 2>/dev/null || true)
|
||
|
|
if [[ "$identifier" == "com.blockline.relaydistrict" ]]; then
|
||
|
|
[[ -z "$app" ]] || { echo "Mehrere BLOCKLINE-Apps gefunden. Bitte nur einen Build hier entpacken."; exit 1; }
|
||
|
|
app="$PWD/${candidate#./}"
|
||
|
|
fi
|
||
|
|
done
|
||
|
|
[[ -n "$app" ]] || { echo "BLOCKLINE-App fehlt neben diesem Starthelfer. ZIP komplett entpacken."; exit 1; }
|
||
|
|
echo "Setze Ausfuehrungsrechte und entferne nur die Quarantaene dieser App."
|
||
|
|
/bin/chmod -R u+rwX,go+rX "$app"
|
||
|
|
/usr/bin/xattr -cr "$app" 2>/dev/null || true
|
||
|
|
echo "Erzeuge eine lokale Ad-hoc-Signatur fuer diesen Rechner."
|
||
|
|
# Das ist keine Entwickler-ID und keine Notarisierung; es macht den lokalen
|
||
|
|
# Export startbar, wenn ein Entpacker Unix-Rechte oder die Signatur veraendert.
|
||
|
|
/usr/bin/codesign --force --deep --sign - "$app"
|
||
|
|
/usr/bin/codesign --verify --deep --strict --verbose=2 "$app"
|
||
|
|
executable=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$app/Contents/Info.plist")
|
||
|
|
if [[ -z "$executable" || ! -x "$app/Contents/MacOS/$executable" ]]; then
|
||
|
|
echo "Executable im App-Bundle fehlt oder ist nicht startbar."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
echo "Starte direkt: $executable"
|
||
|
|
# LaunchServices liefert bei lokal ad-hoc signierten Windows-Exports oft
|
||
|
|
# NSOSStatus/LaunchServices-Fehler. Der direkte Bundle-Start umgeht genau das.
|
||
|
|
cd "$app/Contents/Resources"
|
||
|
|
exec "$app/Contents/MacOS/$executable"
|