summaryrefslogtreecommitdiff
path: root/ext/installfiles/mac
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-03 15:39:09 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-03 15:39:09 -0800
commit59b1623477e7cd9081d3cf75ea3fa0411214d58f (patch)
treee8b37f673d23b45cbe7a63ec5360a0a627d9820f /ext/installfiles/mac
parent22b52858e04c25709081251300fed6cdc42810be (diff)
downloadinfinitytier-59b1623477e7cd9081d3cf75ea3fa0411214d58f.tar.gz
infinitytier-59b1623477e7cd9081d3cf75ea3fa0411214d58f.zip
More install/deploy work for mac...
Diffstat (limited to 'ext/installfiles/mac')
-rw-r--r--ext/installfiles/mac/install.tmpl.sh32
1 files changed, 31 insertions, 1 deletions
diff --git a/ext/installfiles/mac/install.tmpl.sh b/ext/installfiles/mac/install.tmpl.sh
index fcb3b69b..a1675b1d 100644
--- a/ext/installfiles/mac/install.tmpl.sh
+++ b/ext/installfiles/mac/install.tmpl.sh
@@ -15,10 +15,19 @@ fi
if [ $dryRun -gt 0 ]; then
alias ln="echo '>> dry run: ln'"
alias rm="echo '>> dry run: rm'"
+ alias mv="echo '>> dry run: mv'"
+ alias chown="echo '>> dry run: chown'"
+ alias chgrp="echo '>> dry run: chgrp'"
alias launchctl="echo '>> dry run: launchctl'"
alias zerotier-cli="echo '>> dry run: zerotier-cli'"
fi
+zthome="/Library/Application Support/ZeroTier/One"
+ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne'`
+if [ ! -d "$ztapp" ]; then
+ ztapp="/Applications/ZeroTier One.app"
+fi
+
scriptPath="`dirname "$0"`/`basename "$0"`"
if [ ! -r "$scriptPath" ]; then
scriptPath="$0"
@@ -46,11 +55,32 @@ else
tail -c +$blobStart "$scriptPath" | bunzip2 -c | tar -xvop -C / -f -
fi
-if [ $dryRun -eq 0 -a ! -f "/Library/LaunchDaemons/com.zerotier.one.plist" ]; then
+if [ $dryRun -eq 0 -a ! -d "/Applications/ZeroTierOne_app.LATEST" ]; then
echo 'Archive extraction failed, cannot find zerotier-one binary.'
exit 2
fi
+echo 'Installing/updating ZeroTier One.app...'
+
+if [ -d "$ztapp" ]; then
+ # Preserve ownership of existing .app and install new version in the
+ # same location.
+ currentAppOwner=`stat -f '%u' "$ztapp"`
+ currentAppGroup=`stat -f '%g' "$ztapp"`
+ if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then
+ rm -rf "$ztapp"
+ mv -f "/Application/ZeroTierOne_app.LATEST" "$ztapp"
+ chown -R $currentAppOwner "$ztapp"
+ chgrp -R $currentAppGroup "$ztapp"
+ else
+ rm -rf "$ztapp"
+ mv -f "/Application/ZeroTierOne_app.LATEST" "$ztapp"
+ fi
+else
+ # If there is no existing app, just drop the shipped one into place
+ mv -f "/Applications/ZeroTierOne_app.LATEST" "/Applications/ZeroTierOne.app"
+fi
+
echo 'Installing zerotier-cli command line utility...'
ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" /usr/bin/zerotier-cli