Skip to content

Commit 7708487

Browse files
committed
fix: support old VPN config names in post & pre install scripts
1 parent afd9634 commit 7708487

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

pkgbuild/scripts/postinstall

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ VPN_MARKER_FILE="/tmp/coder_vpn_was_running"
66
# Before this script, or the user, opens the app, make sure
77
# Gatekeeper has ingested the notarization ticket.
88
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.
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.
1212
spctl -avvv "/Applications/Coder Desktop.app/Contents/Library/SystemExtensions/com.coder.Coder-Desktop.VPN.systemextension" || true
1313

1414
# Restart Coder Desktop if it was running before
@@ -24,7 +24,7 @@ if [ -f "$VPN_MARKER_FILE" ]; then
2424
echo "Restarting CoderVPN..."
2525
echo "Sleeping for 3..."
2626
sleep 3
27-
scutil --nc start "Coder"
27+
scutil --nc start "$(scutil --nc list | grep "com.coder.Coder-Desktop" | awk -F'"' '{print $2}')"
2828
rm "$VPN_MARKER_FILE"
2929
echo "CoderVPN started."
3030
fi

pkgbuild/scripts/preinstall

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@ if pgrep 'Coder Desktop'; then
99
touch $RUNNING_MARKER_FILE
1010
fi
1111

12+
vpnName=$(scutil --nc list | grep "com.coder.Coder-Desktop" | awk -F'"' '{print $2}')
13+
1214
echo "Turning off VPN"
13-
if scutil --nc list | grep -q "Coder"; then
15+
if [[ -n "$vpnName" ]]; then
1416
echo "CoderVPN found. Stopping..."
15-
if scutil --nc status "Coder" | grep -q "^Connected$"; then
17+
if scutil --nc status "$vpnName" | grep -q "^Connected$"; then
1618
touch $VPN_MARKER_FILE
1719
fi
18-
scutil --nc stop "Coder"
20+
scutil --nc stop "$vpnName"
1921

2022
# Wait for VPN to be disconnected
21-
while scutil --nc status "Coder" | grep -q "^Connected$"; do
23+
while scutil --nc status "$vpnName" | grep -q "^Connected$"; do
2224
echo "Waiting for VPN to disconnect..."
2325
sleep 1
2426
done
25-
while scutil --nc status "Coder" | grep -q "^Disconnecting$"; do
27+
while scutil --nc status "$vpnName" | grep -q "^Disconnecting$"; do
2628
echo "Waiting for VPN to complete disconnect..."
2729
sleep 1
2830
done

0 commit comments

Comments
 (0)