From 81f2c57656e9ae227242a473d23f10d0191489ed Mon Sep 17 00:00:00 2001
From: Adam Ierymenko <adam.ierymenko@zerotier.com>
Date: Wed, 27 Oct 2021 16:17:57 -0400
Subject: [PATCH] Properly launch the app on post-install restart.

---
 ext/installfiles/mac/postinst.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ext/installfiles/mac/postinst.sh b/ext/installfiles/mac/postinst.sh
index dd6ce375d..707b46701 100755
--- a/ext/installfiles/mac/postinst.sh
+++ b/ext/installfiles/mac/postinst.sh
@@ -40,9 +40,9 @@ ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" zerotier-idtool
 if [ -f /tmp/zt1-gui-restart.tmp ]; then
 	for u in `cat /tmp/zt1-gui-restart.tmp`; do
 		if [ -f '/Applications/ZeroTier One.app/Contents/MacOS/ZeroTier One' ]; then
-			su $u -c '/Applications/ZeroTier\ One.app/Contents/MacOS/ZeroTier\ One &' >>/dev/null 2>&1 &
+			su $u -c '/usr/bin/open /Applications/ZeroTier\ One.app &' >>/dev/null 2>&1 &
 		else
-			su $u -c '/Applications/ZeroTier.app/Contents/MacOS/ZeroTier &' >>/dev/null 2>&1 &
+			su $u -c '/usr/bin/open /Applications/ZeroTier.app &' >>/dev/null 2>&1 &
 		fi
 	done
 fi