summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-03-05 22:33:58 +0100
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-03-05 22:33:58 +0100
commitb2673eab55ed93de67104ebf2c850371faba8292 (patch)
treee3c78235e51fc1a21bf7422dc41691e84c7e9dce /ext
parent282d41bc94762b1ad4dde36dfad5c6a8d3405299 (diff)
downloadinfinitytier-b2673eab55ed93de67104ebf2c850371faba8292.tar.gz
infinitytier-b2673eab55ed93de67104ebf2c850371faba8292.zip
Revisions to Linux install script, and support for init.d or upstart systems without chkconfig (Ubuntu).
Diffstat (limited to 'ext')
-rw-r--r--ext/installfiles/linux/install.tmpl.sh57
-rwxr-xr-xext/installfiles/linux/uninstall.sh9
2 files changed, 53 insertions, 13 deletions
diff --git a/ext/installfiles/linux/install.tmpl.sh b/ext/installfiles/linux/install.tmpl.sh
index 1c3ae23c..3968b264 100644
--- a/ext/installfiles/linux/install.tmpl.sh
+++ b/ext/installfiles/linux/install.tmpl.sh
@@ -29,15 +29,17 @@ if [ -e /bin/systemctl -o -e /usr/bin/systemctl -o -e /usr/local/bin/systemctl -
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 chkconfig="echo '>> dry run: chkconfig'"
- alias zerotier-cli="echo '>> dry run: zerotier-cli'"
- alias service="echo '>> dry run: service'"
- alias systemctl="echo '>> dry run: systemctl'"
+ alias ln="echo '>> ln'"
+ alias rm="echo '>> rm'"
+ alias mv="echo '>> mv'"
+ alias cp="echo '>> cp'"
+ alias chown="echo '>> chown'"
+ alias chgrp="echo '>> chgrp'"
+ alias chmod="echo '>> chmod'"
+ alias chkconfig="echo '>> chkconfig'"
+ alias zerotier-cli="echo '>> zerotier-cli'"
+ alias service="echo '>> service'"
+ alias systemctl="echo '>> systemctl'"
fi
scriptPath="`dirname "$0"`/`basename "$0"`"
@@ -62,7 +64,8 @@ fi
echo 'Extracting files...'
if [ $dryRun -gt 0 ]; then
- echo ">> dry run: tail -c +$blobStart \"$scriptPath\" | gunzip -c | tar -xvop -C / -f -"
+ echo ">> tail -c +$blobStart \"$scriptPath\" | gunzip -c | tar -xvop -C / -f -"
+ tail -c +$blobStart "$scriptPath" | gunzip -c | tar -t -f - | sed 's/^/>> /'
else
tail -c +$blobStart "$scriptPath" | gunzip -c | tar -xvop --no-overwrite-dir -C / -f -
fi
@@ -102,7 +105,39 @@ else
chmod 0755 /etc/init.d/zerotier-one
rm -f /tmp/systemd_zerotier-one.service /tmp/init.d_zerotier-one
- chkconfig zerotier-one on
+ if [ -f /sbin/chkconfig -o -f /usr/sbin/chkconfig -o -f /usr/bin/chkconfig -o -f /bin/chkconfig ]; then
+ chkconfig zerotier-one on
+ else
+ if [ -d /etc/rc0.d ]; then
+ rm -f /etc/rc0.d/???zerotier-one
+ ln -sf /etc/init.d/zerotier-one /etc/rc0.d/K89zerotier-one
+ fi
+ if [ -d /etc/rc1.d ]; then
+ rm -f /etc/rc1.d/???zerotier-one
+ ln -sf /etc/init.d/zerotier-one /etc/rc1.d/K89zerotier-one
+ fi
+ if [ -d /etc/rc2.d ]; then
+ rm -f /etc/rc2.d/???zerotier-one
+ ln -sf /etc/init.d/zerotier-one /etc/rc2.d/S11zerotier-one
+ fi
+ if [ -d /etc/rc3.d ]; then
+ rm -f /etc/rc3.d/???zerotier-one
+ ln -sf /etc/init.d/zerotier-one /etc/rc3.d/S11zerotier-one
+ fi
+ if [ -d /etc/rc4.d ]; then
+ rm -f /etc/rc4.d/???zerotier-one
+ ln -sf /etc/init.d/zerotier-one /etc/rc4.d/S11zerotier-one
+ fi
+ if [ -d /etc/rc5.d ]; then
+ rm -f /etc/rc5.d/???zerotier-one
+ ln -sf /etc/init.d/zerotier-one /etc/rc5.d/S11zerotier-one
+ fi
+ if [ -d /etc/rc6.d ]; then
+ rm -f /etc/rc6.d/???zerotier-one
+ ln -sf /etc/init.d/zerotier-one /etc/rc6.d/K89zerotier-one
+ fi
+ fi
+
service zerotier-one restart &
fi
diff --git a/ext/installfiles/linux/uninstall.sh b/ext/installfiles/linux/uninstall.sh
index deddf252..6d3a3331 100755
--- a/ext/installfiles/linux/uninstall.sh
+++ b/ext/installfiles/linux/uninstall.sh
@@ -34,7 +34,9 @@ if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
systemctl stop zerotier-one
systemctl disable zerotier-one
else
- service stop zerotier-one
+ if [ -f /sbin/service -o -f /usr/sbin/service -o -f /bin/service -o -f /usr/bin/service ]; then
+ service stop zerotier-one
+ fi
fi
sleep 1
killall -q -TERM zerotier-one
@@ -43,8 +45,11 @@ killall -q -KILL zerotier-one
if [ -f /etc/init.d/zerotier-one ]; then
echo "Removing SysV init items..."
+ if [ -f /sbin/chkconfig -o -f /usr/sbin/chkconfig -o -f /bin/chkconfig -o -f /usr/bin/chkconfig ]; then
+ chkconfig zerotier-one off
+ fi
rm -f /etc/init.d/zerotier-one
- find /etc/rc*.d -name '???zerotier-one' -print0 | xargs -0 rm -f
+ find /etc/rc*.d -type f -name '???zerotier-one' -print0 | xargs -0 rm -f
fi
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" -a -f "$SYSTEMDUNITDIR/zerotier-one.service" ]; then