-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbundle.sh
More file actions
executable file
·45 lines (42 loc) · 1.77 KB
/
Copy pathbundle.sh
File metadata and controls
executable file
·45 lines (42 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# Builds BotDeck and assembles a signed .app bundle.
# TCC (Screen Recording, Accessibility) keys off the bundle ID + code signature,
# so a bare SwiftPM executable can never hold those permissions.
set -euo pipefail
cd "$(dirname "$0")"
APP="${1:-$HOME/Applications/BotDeck.app}"
swift build -c release
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cp .build/release/BotDeck "$APP/Contents/MacOS/BotDeck"
cat > "$APP/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key><string>BotDeck</string>
<key>CFBundleDisplayName</key><string>Bot Deck</string>
<key>CFBundleIdentifier</key><string>sh.botdeck.app</string>
<key>CFBundleExecutable</key><string>BotDeck</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>0.1</string>
<key>CFBundleVersion</key><string>1</string>
<key>LSMinimumSystemVersion</key><string>14.0</string>
<key>NSHighResolutionCapable</key><true/>
<key>LSUIElement</key><false/>
</dict>
</plist>
PLIST
# Sign with a stable self-signed identity if present. TCC records a designated
# requirement pinned to the certificate, so Screen Recording / Accessibility
# grants survive rebuilds. Ad-hoc signing pins the code hash instead, which
# changes every build and silently drops both permissions.
IDENTITY="BotDeck Local Signing"
if security find-identity -v -p codesigning | grep -q "$IDENTITY"; then
codesign --force --deep --sign "$IDENTITY" "$APP"
echo "signed with '$IDENTITY'"
else
codesign --force --deep --sign - "$APP"
echo "signed ad-hoc (permissions will reset on each rebuild)"
fi
echo "built $APP"