summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-11-06 15:04:05 -0500
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-11-06 15:04:05 -0500
commitf51478b4702cc3c15d81972442a9dbf94db54ed4 (patch)
tree62b8097eb2d85f62a84c2fca10ab756daf6e70d6
parent93427b8cb602abaabc4e3768b4b4dd9105e940eb (diff)
downloadinfinitytier-f51478b4702cc3c15d81972442a9dbf94db54ed4.tar.gz
infinitytier-f51478b4702cc3c15d81972442a9dbf94db54ed4.zip
Uninstaller scripts for *nix.
-rw-r--r--installer.cpp5
-rwxr-xr-xinstaller/linux/uninstall.sh34
-rwxr-xr-xinstaller/mac/uninstall.sh21
3 files changed, 60 insertions, 0 deletions
diff --git a/installer.cpp b/installer.cpp
index 40694048..b540cddf 100644
--- a/installer.cpp
+++ b/installer.cpp
@@ -55,6 +55,11 @@
// zerotier-one binary (or zerotier-one.exe for Windows)
#include "installer-build/zerotier-one.build.c"
+// Unix uninstall script
+#ifdef __UNIX_LIKE__
+#include "installer-build/uninstall.sh.build.c"
+#endif
+
// Linux init.d script
#ifdef __LINUX__
#include "installer-build/redhat__init.d__zerotier-one.build.c"
diff --git a/installer/linux/uninstall.sh b/installer/linux/uninstall.sh
new file mode 100755
index 00000000..ba1418a1
--- /dev/null
+++ b/installer/linux/uninstall.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
+
+if [ "$UID" -ne 0 ]; then
+ echo "Must be run as root; try: sudo ./uninstall.sh"
+ exit 1
+fi
+
+echo "Going to uninstall zerotier-one, hit CTRL+C to abort."
+echo "Waiting 5 seconds..."
+sleep 5
+
+ztpath="/Library/Application Support/ZeroTier/One"
+
+echo "Killing any running zerotier-one service..."
+killall -TERM zerotier-one
+sleep 3
+killall -q -KILL zerotier-one
+
+echo "Erasing binary and support files..."
+cd $ztpath
+rm -fv zerotier-one
+rm -rfv updates.d
+rm -fv *.persist
+rm -rfv networks.d
+rm -fv authtoken.secret
+rm -fv identity.public
+
+echo "Removing init items..."
+chkconfig zerotier-one off
+rm -fv /etc/init.d/zerotier-one
+
+echo "Done. (identity still preserved in $ztpath)"
diff --git a/installer/mac/uninstall.sh b/installer/mac/uninstall.sh
new file mode 100755
index 00000000..2d4079ad
--- /dev/null
+++ b/installer/mac/uninstall.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ "$UID" -ne 0 ]; then
+ echo "Must be run as root; try: sudo ./uninstall.sh"
+ exit 1
+fi
+
+ztpath="/Library/Application Support/ZeroTier/One"
+
+echo "Killing any running zerotier-one service..."
+killall zerotier-one
+sleep 5
+
+echo "Erasing binary and support files..."
+cd $ztpath
+rm -fv zerotier-one
+rm -rfv updates.d
+rm -fv *.persist
+rm -rfv networks.d
+rm -fv authtoken.secret
+