-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·34 lines (29 loc) · 1.47 KB
/
run.sh
File metadata and controls
executable file
·34 lines (29 loc) · 1.47 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
#!/bin/bash
# Build FluentKey, install to ~/Applications/FluentKey.app (stable path so
# Accessibility permission persists across rebuilds), and relaunch.
set -e
cd "$(dirname "$0")"
xcodebuild -project FluentKey.xcodeproj -scheme FluentKey -configuration Release build -quiet
BUILT_DIR=$(xcodebuild -project FluentKey.xcodeproj -scheme FluentKey -configuration Release -showBuildSettings 2>/dev/null | grep -m1 " BUILT_PRODUCTS_DIR = " | sed 's/.*= //')
SRC_APP="$BUILT_DIR/FluentKey.app"
DEST_DIR="$HOME/Applications"
DEST_APP="$DEST_DIR/FluentKey.app"
mkdir -p "$DEST_DIR"
pkill -x FluentKey 2>/dev/null || true
sleep 0.3
rm -rf "$DEST_APP"
cp -R "$SRC_APP" "$DEST_APP"
# Re-sign with the stable self-signed identity from scripts/setup-signing.sh
# when available. TCC keys Accessibility grants by certificate identity, so a
# stable cert across builds keeps the grant alive. Falls back to whatever
# Xcode produced when the identity isn't installed.
SIGNING_IDENTITY="FluentKey Dev"
if security find-certificate -c "$SIGNING_IDENTITY" "$HOME/Library/Keychains/login.keychain-db" >/dev/null 2>&1; then
codesign --force --sign "$SIGNING_IDENTITY" --deep "$DEST_APP" >/dev/null 2>&1 \
&& echo "✓ Signed with '$SIGNING_IDENTITY' — Accessibility grant should persist."
else
echo "⚠︎ No stable signing identity found. Run ./scripts/setup-signing.sh once"
echo " to stop having to re-grant Accessibility permission on every rebuild."
fi
open "$DEST_APP"
echo "Launched: $DEST_APP"