Skip to content

Commit 6947811

Browse files
chore(pkgbuild): delete existing app during preinstall, spctl --assess during postinstall (#112)
Relates to #83. It looks like deleting the app does indeed kill the NE process, so we should do that during `preinstall`. In case the XPC issue we've been seeing is due to a race between the app being opened, and Gatekeeper ingesting the notarization ticket, we'll also force Gatekeeper to read the ticket by running `spctl -a` on the app bundle, and the extension bundle. The latter always fails, but an attempt to read it can't hurt.
1 parent e8e4004 commit 6947811

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

pkgbuild/scripts/postinstall

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
RUNNING_MARKER_FILE="/tmp/coder_desktop_running"
44
VPN_MARKER_FILE="/tmp/coder_vpn_was_running"
55

6+
# Before this script, or the user, opens the app, make sure
7+
# Gatekeeper has ingested the notarization ticket.
8+
spctl -avvv "/Applications/Coder Desktop.app"
9+
# spctl can't assess non-apps, so this will always return a non-zero exit code,
10+
# but the error message implies at minimum the signature of the extension was
11+
# checked.
12+
spctl -avvv "/Applications/Coder Desktop.app/Contents/Library/SystemExtensions/com.coder.Coder-Desktop.VPN.systemextension" || true
13+
614
# Restart Coder Desktop if it was running before
715
if [ -f "$RUNNING_MARKER_FILE" ]; then
816
echo "Starting Coder Desktop..."

pkgbuild/scripts/preinstall

+7
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ echo "Asking com.coder.Coder-Desktop to quit..."
3535
osascript -e 'if app id "com.coder.Coder-Desktop" is running then' -e 'quit app id "com.coder.Coder-Desktop"' -e 'end if'
3636
echo "Done."
3737

38+
APP="/Applications/Coder Desktop.app"
39+
if [ -d "$APP" ]; then
40+
echo "Deleting Coder Desktop..."
41+
rm -rf "$APP"
42+
echo "Done."
43+
fi
44+
3845
exit 0

0 commit comments

Comments
 (0)