summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-10 14:09:08 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-10 14:09:08 -0800
commit2a3c9e73e52d86a720153d6330b3b7a70c7df7af (patch)
tree6013f5f67812c7945c1fbd22d81901bd208f0150 /ext
parent15854a1b1416b5b2072114882e9bed06a14aae3c (diff)
downloadinfinitytier-2a3c9e73e52d86a720153d6330b3b7a70c7df7af.tar.gz
infinitytier-2a3c9e73e52d86a720153d6330b3b7a70c7df7af.zip
More mac installer fixes.
Diffstat (limited to 'ext')
-rw-r--r--ext/installfiles/mac/install.tmpl.sh27
-rwxr-xr-xext/installfiles/mac/uninstall.sh6
2 files changed, 24 insertions, 9 deletions
diff --git a/ext/installfiles/mac/install.tmpl.sh b/ext/installfiles/mac/install.tmpl.sh
index 24934d8d..3dfb79f5 100644
--- a/ext/installfiles/mac/install.tmpl.sh
+++ b/ext/installfiles/mac/install.tmpl.sh
@@ -25,9 +25,9 @@ if [ $dryRun -gt 0 ]; then
fi
zthome="/Library/Application Support/ZeroTier/One"
-ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.*ZeroTier One[.]app$' | sort | head -n 1`
-if [ -z "$ztapp" -o ! -d "$ztapp" ]; then
- ztapp="/Applications/ZeroTier One.app"
+ztapp="/Applications/ZeroTier One.app"
+if [ ! -d "$ztapp" ]; then
+ ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.*ZeroTier One[.]app$' | grep -v -F '/build-' | grep -v -F '/Volumes/ZeroTier' | sort | head -n 1`
fi
scriptPath="`dirname "$0"`/`basename "$0"`"
@@ -62,7 +62,7 @@ fi
cd '/tmp/_zt1tmp'
if [ $dryRun -eq 0 -a ! -d './Applications/ZeroTier One.app' ]; then
- echo 'Archive extraction failed, cannot find zerotier-one binary.'
+ echo 'Archive extraction failed, cannot find files in /tmp/_zt1tmp.'
exit 2
fi
@@ -77,7 +77,11 @@ chown -R root:wheel "$zthome/pre10.8/tap.kext"
echo 'Installing/updating ZeroTier One.app...'
-if [ ! -z "$ztapp" -a -d "$ztapp" ]; then
+if [ ! -z "$ztapp" -a -d "$ztapp" -a -f "$ztapp/Contents/Info.plist" ]; then
+ # Preserve ownership of current app across updates... that way the admin
+ # user who dragged it into /Applications can just trash it the way they
+ # would any other app. This works (due to mdfind up top) even if they put
+ # it somewhere non-standard on their system.
currentAppOwner=`stat -f '%u' "$ztapp"`
currentAppGroup=`stat -f '%g' "$ztapp"`
@@ -87,10 +91,16 @@ if [ ! -z "$ztapp" -a -d "$ztapp" ]; then
if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then
chown -R $currentAppOwner "$ztapp"
chgrp -R $currentAppGroup "$ztapp"
+ else
+ chown -R root "$ztapp"
+ chgrp -R admin "$ztapp"
fi
else
# If there is no existing app, just drop the shipped one into place
- mv -f './Applications/ZeroTier One.app' "/Applications/ZeroTier One.app"
+ ztapp="/Applications/ZeroTier One.app"
+ mv -f './Applications/ZeroTier One.app' "$ztapp"
+ chown -R root "$ztapp"
+ chgrp -R admin "$ztapp"
fi
# Set up symlink that watches for app deletion
@@ -99,8 +109,12 @@ ln -sf "$ztapp/Contents/Info.plist" "$zthome/shutdownIfUnreadable"
echo 'Installing zerotier-cli command line utility...'
+rm -f /usr/bin/zerotier-cli
ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" /usr/bin/zerotier-cli
+# This lets the install helper AppleScript thingy go ahead and authorize the
+# user after the installer is done, skiping that step for the user who did
+# the service install.
if [ ! -f '/Library/Application Support/ZeroTier/One/authtoken.secret' ]; then
echo 'Pre-creating authtoken.secret for ZeroTier service...'
if [ $dryRun -eq 0 ]; then
@@ -115,6 +129,7 @@ echo 'Installing and (re-)starting zerotier-one service via launchctl...'
mv -f './Library/LaunchDaemons/com.zerotier.one.plist' '/Library/LaunchDaemons/'
if [ ! -z "`launchctl list | grep -F com.zerotier.one`" ]; then
launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist
+ sleep 1
fi
launchctl load /Library/LaunchDaemons/com.zerotier.one.plist
diff --git a/ext/installfiles/mac/uninstall.sh b/ext/installfiles/mac/uninstall.sh
index 546360b4..4cb5cec5 100755
--- a/ext/installfiles/mac/uninstall.sh
+++ b/ext/installfiles/mac/uninstall.sh
@@ -3,9 +3,9 @@
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
zthome="/Library/Application Support/ZeroTier/One"
-ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.*/ZeroTier One[.]app$' | sort | head -n 1`
+ztapp="/Applications/ZeroTier One.app"
if [ -z "$ztapp" -o ! -d "$ztapp" ]; then
- ztapp="/Applications/ZeroTier One.app"
+ ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.*ZeroTier One[.]app$' | grep -v -F '/build-' | grep -v -F '/Volumes/ZeroTier' | sort | head -n 1`
fi
if [ "$UID" -ne 0 ]; then
@@ -24,7 +24,7 @@ kextunload "$zthome/pre10.8/tap.kext" >>/dev/null 2>&1
kextunload "$zthome/tap.kext" >>/dev/null 2>&1
echo "Erasing GUI app (if installed)..."
-if [ ! -z "$ztapp" -a -d "$ztapp" ]; then
+if [ ! -z "$ztapp" -a -d "$ztapp" -a -f "$ztapp/Contents/Info.plist" ]; then
rm -rf "$ztapp"
fi