summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-03 09:00:59 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-03 09:00:59 -0800
commitfb685bcb1d78fdf45154ded175c37afc6813371a (patch)
tree9e859d038a247860c779cfb0b4c721e453d5cb71
parent14e4e9e479e8ddcb61f8661b05783a8feac58efa (diff)
downloadinfinitytier-fb685bcb1d78fdf45154ded175c37afc6813371a.tar.gz
infinitytier-fb685bcb1d78fdf45154ded175c37afc6813371a.zip
New Unix installer is script-based with a payload... no fracking idea what I will do for Windows.
-rwxr-xr-x.gitignore6
-rw-r--r--ext/installfiles/mac/install.tmpl.sh74
-rwxr-xr-xext/installfiles/mac/uninstall.sh2
3 files changed, 77 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index aecb2fb2..737a2828 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
/ext/llvm-g++-Xcode4.6.2
/ext/llvm-g++-Xcode4.6.2.tar.bz2
/zerotier-*
-/build-ZeroTierUI-*
/ZeroTierUI/*.user
*.o
.DS_Store
@@ -31,8 +30,7 @@ mac-tap/tuntap/tap.kext
*.cache
*.obj
*.tlog
-/installer-build
-/zt1-*-install
-/file2lz4c
+/build-*
+/ZeroTierOne-*-install
.qmake.stash
*.autosave
diff --git a/ext/installfiles/mac/install.tmpl.sh b/ext/installfiles/mac/install.tmpl.sh
new file mode 100644
index 00000000..75773250
--- /dev/null
+++ b/ext/installfiles/mac/install.tmpl.sh
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+export PATH=/bin:/usr/bin:/sbin:/usr/sbin
+shopt -s expand_aliases
+
+dryRun=0
+
+echo "*** ZeroTier One install/update ***"
+
+if [ "$UID" -ne 0 ]; then
+ echo "Not running as root so doing dry run (no modifications to system)..."
+ dryRun=1
+fi
+
+if [ $dryRun -gt 0 ]; then
+ alias ln="echo '>> dry run: ln'"
+ alias rm="echo '>> dry run: rm'"
+ alias launchctl="echo '>> dry run: launchctl'"
+ alias zerotier-cli="echo '>> dry run: zerotier-cli'"
+fi
+
+scriptPath="`dirname "$0"`/`basename "$0"`"
+if [ ! -r "$scriptPath" ]; then
+ scriptPath="$0"
+ if [ ! -r "$scriptPath" ]; then
+ echo "Installer cannot determine its own path; $scriptPath is not readable."
+ exit 2
+ fi
+fi
+
+endMarkerIndex=`grep -b -E '^################' "$scriptPath" | head -n 1 | cut -d : -f 1`
+if [ "$endMarkerIndex" -le 100 ]; then
+ echo 'Internal error: unable to find end of script / start of binary data marker.'
+ exit 2
+fi
+blobStart=`expr $endMarkerIndex + 17`
+if [ "$blobStart" -le "$endMarkerIndex" ]; then
+ echo 'Internal error: unable to find end of script / start of binary data marker.'
+ exit 2
+fi
+
+echo 'Extracting files...'
+if [ $dryRun -gt 0 ]; then
+ echo ">> dry run: tail -c +$blobStart \"$scriptPath\" | bunzip2 -c | tar -xvop -C / -f -"
+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
+ echo 'Archive extraction failed, cannot find zerotier-one binary.'
+ exit 2
+fi
+
+echo 'Installing zerotier-cli command line utility...'
+
+ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" /usr/bin/zerotier-cli
+
+echo 'Installing and (re-)starting zerotier-one service via launchctl...'
+
+if [ ! -z "`launchctl list | grep -F com.zerotier.one`" ]; then
+ launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist
+fi
+launchctl load /Library/LaunchDaemons/com.zerotier.one.plist
+
+sleep 1
+zerotier-cli info
+
+exit 0
+
+# Do not remove the last line or add a carriage return to it! The installer
+# looks for an unterminated line beginning with 16 #'s in itself to find
+# the binary blob data, which is appended after it.
+
+################ \ No newline at end of file
diff --git a/ext/installfiles/mac/uninstall.sh b/ext/installfiles/mac/uninstall.sh
index 9d350709..79955a65 100755
--- a/ext/installfiles/mac/uninstall.sh
+++ b/ext/installfiles/mac/uninstall.sh
@@ -13,7 +13,7 @@ fi
# Run with -q to be quieter and run without delay
quickAndQuiet=0
if [ "$1" = "-q" ]; then
- quickAndQuiet=1
+ quickAndQuiet=1
echo() { :; }
fi