summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-02-14 15:28:45 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-02-14 15:28:45 -0800
commitb0277ab904f0a5b6227ea234665e633171aa3962 (patch)
tree2b84689ecc72815049822d758696113206fd7362
parent87b26b0aaf57823d5f217fc94dc0c9940ab45ce9 (diff)
downloadinfinitytier-b0277ab904f0a5b6227ea234665e633171aa3962.tar.gz
infinitytier-b0277ab904f0a5b6227ea234665e633171aa3962.zip
Clean up old init.d installation files on systemd systems if present.
-rw-r--r--ext/installfiles/linux/install.tmpl.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/installfiles/linux/install.tmpl.sh b/ext/installfiles/linux/install.tmpl.sh
index 8202cc93..cbcddc8e 100644
--- a/ext/installfiles/linux/install.tmpl.sh
+++ b/ext/installfiles/linux/install.tmpl.sh
@@ -80,6 +80,15 @@ ln -sf /var/lib/zerotier-one/zerotier-one /usr/bin/zerotier-cli
echo 'Installing and (re-)starting zerotier-one daemon...'
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
+ # If this was updated or upgraded from an init.d based system, clean up the old
+ # init.d stuff before installing directly via systemd.
+ if [ -f /etc/init.d/zerotier-one ]; then
+ if [ -e /sbin/chkconfig -o -e /usr/sbin/chkconfig -o -e /bin/chkconfig -o -e /usr/bin/chkconfig ]; then
+ chkconfig zerotier-one off
+ fi
+ rm -f /etc/init.d/zerotier-one
+ fi
+
cp -f /tmp/systemd_zerotier-one.service "$SYSTEMDUNITDIR/zerotier-one.service"
systemctl enable zerotier-one
systemctl restart zerotier-one