mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
More mac installer fixes.
This commit is contained in:
parent
15854a1b14
commit
2a3c9e73e5
2 changed files with 24 additions and 9 deletions
|
@ -25,9 +25,9 @@ if [ $dryRun -gt 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zthome="/Library/Application Support/ZeroTier/One"
|
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
|
fi
|
||||||
|
|
||||||
scriptPath="`dirname "$0"`/`basename "$0"`"
|
scriptPath="`dirname "$0"`/`basename "$0"`"
|
||||||
|
@ -62,7 +62,7 @@ fi
|
||||||
cd '/tmp/_zt1tmp'
|
cd '/tmp/_zt1tmp'
|
||||||
|
|
||||||
if [ $dryRun -eq 0 -a ! -d './Applications/ZeroTier One.app' ]; then
|
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
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -77,7 +77,11 @@ chown -R root:wheel "$zthome/pre10.8/tap.kext"
|
||||||
|
|
||||||
echo 'Installing/updating ZeroTier One.app...'
|
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"`
|
currentAppOwner=`stat -f '%u' "$ztapp"`
|
||||||
currentAppGroup=`stat -f '%g' "$ztapp"`
|
currentAppGroup=`stat -f '%g' "$ztapp"`
|
||||||
|
|
||||||
|
@ -87,10 +91,16 @@ if [ ! -z "$ztapp" -a -d "$ztapp" ]; then
|
||||||
if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then
|
if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then
|
||||||
chown -R $currentAppOwner "$ztapp"
|
chown -R $currentAppOwner "$ztapp"
|
||||||
chgrp -R $currentAppGroup "$ztapp"
|
chgrp -R $currentAppGroup "$ztapp"
|
||||||
|
else
|
||||||
|
chown -R root "$ztapp"
|
||||||
|
chgrp -R admin "$ztapp"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# If there is no existing app, just drop the shipped one into place
|
# 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
|
fi
|
||||||
|
|
||||||
# Set up symlink that watches for app deletion
|
# 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...'
|
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
|
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
|
if [ ! -f '/Library/Application Support/ZeroTier/One/authtoken.secret' ]; then
|
||||||
echo 'Pre-creating authtoken.secret for ZeroTier service...'
|
echo 'Pre-creating authtoken.secret for ZeroTier service...'
|
||||||
if [ $dryRun -eq 0 ]; then
|
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/'
|
mv -f './Library/LaunchDaemons/com.zerotier.one.plist' '/Library/LaunchDaemons/'
|
||||||
if [ ! -z "`launchctl list | grep -F com.zerotier.one`" ]; then
|
if [ ! -z "`launchctl list | grep -F com.zerotier.one`" ]; then
|
||||||
launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist
|
launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
launchctl load /Library/LaunchDaemons/com.zerotier.one.plist
|
launchctl load /Library/LaunchDaemons/com.zerotier.one.plist
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||||
|
|
||||||
zthome="/Library/Application Support/ZeroTier/One"
|
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 [ -z "$ztapp" -o ! -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
|
fi
|
||||||
|
|
||||||
if [ "$UID" -ne 0 ]; then
|
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
|
kextunload "$zthome/tap.kext" >>/dev/null 2>&1
|
||||||
|
|
||||||
echo "Erasing GUI app (if installed)..."
|
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"
|
rm -rf "$ztapp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue