mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Mac installer work...
This commit is contained in:
parent
12a0a9dedd
commit
15854a1b14
5 changed files with 66 additions and 75 deletions
|
@ -58,17 +58,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
pollServiceTimerId(0)
|
pollServiceTimerId(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->pollServiceTimerId = this->startTimer(1000);
|
|
||||||
this->setEnabled(false); // gets enabled when updates are received
|
|
||||||
mainWindow = this;
|
|
||||||
this->cyclesSinceResponseFromService = 0;
|
|
||||||
|
|
||||||
if (ui->networkListWidget->verticalScrollBar())
|
|
||||||
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
|
|
||||||
|
|
||||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
|
||||||
foreach(QWidget* widget, widgets)
|
|
||||||
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
|
if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
|
||||||
|
@ -82,6 +71,18 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
this->pollServiceTimerId = this->startTimer(1000);
|
||||||
|
this->setEnabled(false); // gets enabled when updates are received
|
||||||
|
mainWindow = this;
|
||||||
|
this->cyclesSinceResponseFromService = 0;
|
||||||
|
|
||||||
|
if (ui->networkListWidget->verticalScrollBar())
|
||||||
|
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
|
||||||
|
|
||||||
|
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||||
|
foreach(QWidget* widget, widgets)
|
||||||
|
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
|
|
@ -70,7 +70,6 @@ case "$system" in
|
||||||
|
|
||||||
mkdir -p 'build-installer/Applications'
|
mkdir -p 'build-installer/Applications'
|
||||||
cp -a 'build-ZeroTierUI-release/ZeroTier One.app' 'build-installer/Applications'
|
cp -a 'build-ZeroTierUI-release/ZeroTier One.app' 'build-installer/Applications'
|
||||||
mv -f 'build-installer/Applications/ZeroTier One.app' 'build-installer/Applications/ZeroTier One_app.LATEST'
|
|
||||||
mkdir -p 'build-installer/Library/Application Support/ZeroTier/One'
|
mkdir -p 'build-installer/Library/Application Support/ZeroTier/One'
|
||||||
cp -fp 'ext/installfiles/mac/uninstall.sh' 'build-installer/Library/Application Support/ZeroTier/One'
|
cp -fp 'ext/installfiles/mac/uninstall.sh' 'build-installer/Library/Application Support/ZeroTier/One'
|
||||||
cp -fp 'ext/installfiles/mac/launch.sh' 'build-installer/Library/Application Support/ZeroTier/One'
|
cp -fp 'ext/installfiles/mac/launch.sh' 'build-installer/Library/Application Support/ZeroTier/One'
|
||||||
|
|
|
@ -16,15 +16,17 @@ if [ $dryRun -gt 0 ]; then
|
||||||
alias ln="echo '>> dry run: ln'"
|
alias ln="echo '>> dry run: ln'"
|
||||||
alias rm="echo '>> dry run: rm'"
|
alias rm="echo '>> dry run: rm'"
|
||||||
alias mv="echo '>> dry run: mv'"
|
alias mv="echo '>> dry run: mv'"
|
||||||
|
alias cp="echo '>> dry run: cp'"
|
||||||
alias chown="echo '>> dry run: chown'"
|
alias chown="echo '>> dry run: chown'"
|
||||||
alias chgrp="echo '>> dry run: chgrp'"
|
alias chgrp="echo '>> dry run: chgrp'"
|
||||||
|
alias chmod="echo '>> dry run: chmod'"
|
||||||
alias launchctl="echo '>> dry run: launchctl'"
|
alias launchctl="echo '>> dry run: launchctl'"
|
||||||
alias zerotier-cli="echo '>> dry run: zerotier-cli'"
|
alias zerotier-cli="echo '>> dry run: zerotier-cli'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zthome="/Library/Application Support/ZeroTier/One"
|
zthome="/Library/Application Support/ZeroTier/One"
|
||||||
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.+[.]app$' | sort | head -n 1`
|
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.*ZeroTier One[.]app$' | sort | head -n 1`
|
||||||
if [ ! -d "$ztapp" ]; then
|
if [ -z "$ztapp" -o ! -d "$ztapp" ]; then
|
||||||
ztapp="/Applications/ZeroTier One.app"
|
ztapp="/Applications/ZeroTier One.app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -52,35 +54,49 @@ echo 'Extracting files...'
|
||||||
if [ $dryRun -gt 0 ]; then
|
if [ $dryRun -gt 0 ]; then
|
||||||
echo ">> dry run: tail -c +$blobStart \"$scriptPath\" | bunzip2 -c | tar -xvop -C / -f -"
|
echo ">> dry run: tail -c +$blobStart \"$scriptPath\" | bunzip2 -c | tar -xvop -C / -f -"
|
||||||
else
|
else
|
||||||
tail -c +$blobStart "$scriptPath" | bunzip2 -c | tar -xvop -C / -f -
|
rm -rf '/tmp/_zt1tmp'
|
||||||
|
mkdir '/tmp/_zt1tmp'
|
||||||
|
tail -c +$blobStart "$scriptPath" | bunzip2 -c | tar -xop -C '/tmp/_zt1tmp' -f -
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $dryRun -eq 0 -a ! -d "/Applications/ZeroTier One_app.LATEST" ]; then
|
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 zerotier-one binary.'
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo 'Installing zerotier-one service...'
|
||||||
|
|
||||||
|
mkdir -p "$zthome"
|
||||||
|
chown root:admin "$zthome"
|
||||||
|
chmod 0750 "$zthome"
|
||||||
|
cp -fa ./Library/Application\ Support/ZeroTier/One/* "$zthome"
|
||||||
|
chown -R root:wheel "$zthome/tap.kext"
|
||||||
|
chown -R root:wheel "$zthome/pre10.8/tap.kext"
|
||||||
|
|
||||||
echo 'Installing/updating ZeroTier One.app...'
|
echo 'Installing/updating ZeroTier One.app...'
|
||||||
|
|
||||||
if [ -d "$ztapp" ]; then
|
if [ ! -z "$ztapp" -a -d "$ztapp" ]; then
|
||||||
# Preserve ownership of existing .app and install new version in the
|
|
||||||
# same location.
|
|
||||||
currentAppOwner=`stat -f '%u' "$ztapp"`
|
currentAppOwner=`stat -f '%u' "$ztapp"`
|
||||||
currentAppGroup=`stat -f '%g' "$ztapp"`
|
currentAppGroup=`stat -f '%g' "$ztapp"`
|
||||||
if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then
|
|
||||||
rm -rf "$ztapp"
|
rm -rf "$ztapp"
|
||||||
mv -f "/Application/ZeroTier One_app.LATEST" "$ztapp"
|
mv -f './Applications/ZeroTier One.app' "$ztapp"
|
||||||
|
|
||||||
|
if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then
|
||||||
chown -R $currentAppOwner "$ztapp"
|
chown -R $currentAppOwner "$ztapp"
|
||||||
chgrp -R $currentAppGroup "$ztapp"
|
chgrp -R $currentAppGroup "$ztapp"
|
||||||
else
|
|
||||||
rm -rf "$ztapp"
|
|
||||||
mv -f "/Application/ZeroTier One_app.LATEST" "$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.LATEST" "/Applications/ZeroTier One.app"
|
mv -f './Applications/ZeroTier One.app' "/Applications/ZeroTier One.app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set up symlink that watches for app deletion
|
||||||
|
rm -f "$zthome/shutdownIfUnreadable"
|
||||||
|
ln -sf "$ztapp/Contents/Info.plist" "$zthome/shutdownIfUnreadable"
|
||||||
|
|
||||||
echo 'Installing zerotier-cli command line utility...'
|
echo 'Installing zerotier-cli command line utility...'
|
||||||
|
|
||||||
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
|
||||||
|
@ -96,13 +112,17 @@ fi
|
||||||
|
|
||||||
echo 'Installing and (re-)starting zerotier-one service via launchctl...'
|
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
|
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
|
||||||
fi
|
fi
|
||||||
launchctl load /Library/LaunchDaemons/com.zerotier.one.plist
|
launchctl load /Library/LaunchDaemons/com.zerotier.one.plist
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
zerotier-cli info
|
/usr/bin/zerotier-cli info
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
rm -rf _zt1tmp
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
|
@ -2,29 +2,14 @@
|
||||||
|
|
||||||
zthome="/Library/Application Support/ZeroTier/One"
|
zthome="/Library/Application Support/ZeroTier/One"
|
||||||
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$zthome"
|
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$zthome"
|
||||||
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.+[.]app$' | sort | head -n 1`
|
|
||||||
|
|
||||||
# Clean all other stuff off the system if the user has trashed the .app
|
# If the app has been deleted, uninstall the service
|
||||||
if [ -z "$ztapp" -o ! -d "$ztapp" ]; then
|
|
||||||
# Double-check default location just in case there is some issue with mdfind
|
|
||||||
ztapp="/Applications/ZeroTier One.app"
|
|
||||||
if [ ! -d "$ztapp" ]; then
|
|
||||||
if [ -e "$zthome/uninstall.sh" ]; then
|
|
||||||
cd "$zthome"
|
cd "$zthome"
|
||||||
nohup "$zthome/uninstall.sh" >/tmp/ZeroTierOneUninstall.log 2>&1 &
|
if [ -L './shutdownIfUnreadable' -a ! -f "`readlink ./shutdownIfUnreadable`" ]; then
|
||||||
disown %1
|
rm -f /tmp/ZeroTierOneUninstall.log
|
||||||
|
/bin/bash "$zthome/uninstall.sh" >/tmp/ZeroTierOneUninstall.log 2>&1
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create the app deletion notification symlink if it does
|
|
||||||
# not already exist.
|
|
||||||
shutdownIfUnreadablePointsTo=`readlink "$zthome/shutdownIfUnreadable"`
|
|
||||||
if [ -z "$shutdownIfUnreadablePointsTo" -o "$shutdownIfUnreadablePointsTo" != "$ztapp/Contents/Info.plist" ]; then
|
|
||||||
rm -f "$zthome/shutdownIfUnreadable"
|
|
||||||
ln -sf "$ztapp/Contents/Info.plist" "$zthome/shutdownIfUnreadable"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Launch ZeroTier One (not as daemon... launchd monitors it)
|
# Launch ZeroTier One (not as daemon... launchd monitors it)
|
||||||
exec zerotier-one
|
exec zerotier-one
|
||||||
|
|
|
@ -3,37 +3,16 @@
|
||||||
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 '.+[.]app$' | sort | head -n 1`
|
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"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$UID" -ne 0 ]; then
|
if [ "$UID" -ne 0 ]; then
|
||||||
echo "Must be run as root; try: sudo $0"
|
echo "Must be run as root; try: sudo $0"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try default location if something's up with mdfind
|
|
||||||
if [ ! -d "$ztapp" ]; then
|
|
||||||
ztapp="/Applications/ZeroTier One.app"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run with -q to be quieter and run without delay
|
|
||||||
quickAndQuiet=0
|
|
||||||
if [ "$1" = "-q" ]; then
|
|
||||||
quickAndQuiet=1
|
|
||||||
echo() { :; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
|
|
||||||
if [ $quickAndQuiet -eq 0 ]; then
|
|
||||||
echo "This will uninstall ZeroTier One, hit CTRL+C to abort."
|
|
||||||
echo "Waiting 5 seconds..."
|
|
||||||
sleep 5
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Unloading and removing LaunchDaemons item..."
|
|
||||||
launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist
|
|
||||||
rm -f /Library/LaunchDaemons/com.zerotier.one.plist
|
|
||||||
|
|
||||||
echo "Killing any running zerotier-one service..."
|
echo "Killing any running zerotier-one service..."
|
||||||
killall -TERM zerotier-one >>/dev/null 2>&1
|
killall -TERM zerotier-one >>/dev/null 2>&1
|
||||||
sleep 3
|
sleep 3
|
||||||
|
@ -41,16 +20,23 @@ killall -KILL zerotier-one >>/dev/null 2>&1
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
echo "Unloading kernel extension..."
|
echo "Unloading kernel extension..."
|
||||||
|
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 [ -d "$ztapp" ]; then
|
if [ ! -z "$ztapp" -a -d "$ztapp" ]; then
|
||||||
rm -rfv "$ztapp"
|
rm -rf "$ztapp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Erasing service and support files..."
|
echo "Erasing service and support files..."
|
||||||
|
rm -f /usr/bin/zerotier-cli
|
||||||
cd "$zthome"
|
cd "$zthome"
|
||||||
rm -rfv zerotier-one *.persist authtoken.secret identity.public *.log *.pid *.kext *.sh networks.d updates.d shutdownIfUnreadable pre10.8
|
rm -f zerotier-one *.persist identity.public *.log *.pid *.sh shutdownIfUnreadable
|
||||||
|
rm -rf pre10.8 tap.kext updates.d networks.d
|
||||||
|
|
||||||
|
echo "Removing LaunchDaemons item..."
|
||||||
|
rm -f /Library/LaunchDaemons/com.zerotier.one.plist
|
||||||
|
launchctl remove com.zerotier.one
|
||||||
|
|
||||||
echo "Done."
|
echo "Done."
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Add table
Reference in a new issue