mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-18 20:47:53 +00:00
systemd stuff for debian
This commit is contained in:
parent
7e68791bee
commit
abd7071eaa
5
.gitignore
vendored
5
.gitignore
vendored
@ -60,7 +60,10 @@ doc/*.8
|
||||
.depend
|
||||
node_modules
|
||||
debian/files
|
||||
debian/zerotier-one*
|
||||
debian/zerotier-one
|
||||
debian/zerotier-one*.debhelper
|
||||
debian/*.log
|
||||
debian/zerotier-one.substvars
|
||||
|
||||
# MacGap wrapper build files
|
||||
/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.xcworkspace/xcuserdata/*
|
||||
|
3
debian/rules
vendored
3
debian/rules
vendored
@ -11,3 +11,6 @@ override_dh_auto_build:
|
||||
|
||||
override_dh_systemd_start:
|
||||
dh_systemd_start --restart-after-upgrade
|
||||
|
||||
override_dh_installinit:
|
||||
dh_installinit --name=zerotier-one -- defaults
|
||||
|
14
debian/zerotier-one.upstart
vendored
Normal file
14
debian/zerotier-one.upstart
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
description "ZeroTier One upstart startup script"
|
||||
|
||||
author "Adam Ierymenko <adam.ierymenko@zerotier.com>"
|
||||
|
||||
start on (local-filesystems and net-device-up IFACE!=lo)
|
||||
stop on runlevel [!2345]
|
||||
|
||||
respawn
|
||||
respawn limit 2 300
|
||||
|
||||
#pre-start script
|
||||
#end script
|
||||
|
||||
exec /usr/sbin/zerotier-one
|
@ -1,113 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# zerotier-one Virtual distributed Ethernet service
|
||||
#
|
||||
# chkconfig: 2345 11 89
|
||||
# description: ZeroTier One provides public and private distributed ethernet \
|
||||
# networks. See https://www.zerotier.com/ for more information.
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: zerotier-one
|
||||
# Required-Start: $local_fs $network
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start ZeroTier One
|
||||
# Description: ZeroTier One provides public and private distributed ethernet \
|
||||
# networks. See https://www.zerotier.com/ for more information.
|
||||
### END INIT INFO
|
||||
|
||||
#
|
||||
# This script is written to avoid distro-specific dependencies, so it does not
|
||||
# use the rc bash script libraries found on some systems. It should work on
|
||||
# just about anything.
|
||||
#
|
||||
|
||||
zthome=/var/lib/zerotier-one
|
||||
|
||||
# Add $zthome to path so we can invoke zerotier-one naked, makes it look
|
||||
# better in a ps listing.
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:$zthome
|
||||
|
||||
if [ "`id -u`" -ne 0 ]; then
|
||||
echo "Init script must be called as root."
|
||||
exit 4
|
||||
fi
|
||||
|
||||
if [ ! -f "$zthome/zerotier-one" ]; then
|
||||
echo "ZeroTier One is not installed in $zthome."
|
||||
exit 5
|
||||
fi
|
||||
|
||||
pid=0
|
||||
if [ -f "$zthome/zerotier-one.pid" ]; then
|
||||
pid=`cat $zthome/zerotier-one.pid`
|
||||
fi
|
||||
|
||||
running=0
|
||||
if [ "$pid" -gt 0 ]; then
|
||||
exepath=`readlink /proc/$pid/exe 2>/dev/null | grep zerotier-one`
|
||||
if [ -n "$exepath" ]; then
|
||||
running=1
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ $running -gt 0 ]; then
|
||||
echo "ZeroTier One already running."
|
||||
exit 0
|
||||
fi
|
||||
echo "Starting ZeroTier One..."
|
||||
zerotier-one -d
|
||||
;;
|
||||
stop)
|
||||
if [ $running -gt 0 ]; then
|
||||
echo "Stopping ZeroTier One..."
|
||||
kill -TERM $pid
|
||||
sleep 0.25
|
||||
if [ -f "$zthome/zerotier-one.pid" ]; then
|
||||
sleep 0.5
|
||||
fi
|
||||
if [ -f "$zthome/zerotier-one.pid" ]; then
|
||||
sleep 1
|
||||
fi
|
||||
if [ -f "$zthome/zerotier-one.pid" ]; then
|
||||
kill -KILL $pid >>/dev/null 2>&1
|
||||
rm -f "$zthome/zerotier-one.pid"
|
||||
fi
|
||||
else
|
||||
echo "ZeroTier One is not running."
|
||||
fi
|
||||
;;
|
||||
restart|reload|force-reload|condrestart|try-restart)
|
||||
echo "Restarting ZeroTier One..."
|
||||
if [ $running -gt 0 ]; then
|
||||
kill -TERM $pid >>/dev/null 2>&1
|
||||
fi
|
||||
sleep 0.25
|
||||
if [ -f "$zthome/zerotier-one.pid" ]; then
|
||||
sleep 0.5
|
||||
fi
|
||||
if [ -f "$zthome/zerotier-one.pid" ]; then
|
||||
sleep 1
|
||||
fi
|
||||
if [ -f "$zthome/zerotier-one.pid" ]; then
|
||||
kill -KILL $pid >>/dev/null 2>&1
|
||||
rm -f "$zthome/zerotier-one.pid"
|
||||
fi
|
||||
zerotier-one -d
|
||||
;;
|
||||
status)
|
||||
if [ $running -gt 0 ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
|
||||
exit 0
|
@ -147,7 +147,7 @@ manpages: FORCE
|
||||
cd doc ; ./build.sh
|
||||
|
||||
clean: FORCE
|
||||
rm -rf *.so *.o netcon/*.a node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o ext/miniupnpc/*.o ext/libnatpmp/*.o $(OBJS) zerotier-one zerotier-idtool zerotier-cli zerotier-selftest zerotier-netcon-service build-* ZeroTierOneInstaller-* *.deb *.rpm .depend netcon/.depend doc/*.1 doc/*.2 doc/*.8 debian/zerotier-one* debian/files
|
||||
rm -rf *.so *.o netcon/*.a node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o ext/miniupnpc/*.o ext/libnatpmp/*.o $(OBJS) zerotier-one zerotier-idtool zerotier-cli zerotier-selftest zerotier-netcon-service build-* ZeroTierOneInstaller-* *.deb *.rpm .depend netcon/.depend doc/*.1 doc/*.2 doc/*.8 debian/files debian/zerotier-one*.debhelper debian/zerotier-one.substvars debian/*.log debian/zerotier-one
|
||||
find netcon -type f \( -name '*.o' -o -name '*.so' -o -name '*.1.0' -o -name 'zerotier-one' -o -name 'zerotier-cli' -o -name 'zerotier-netcon-service' \) -delete
|
||||
find netcon/docker-test -name "zerotier-intercept" -type f -delete
|
||||
|
||||
@ -182,9 +182,6 @@ install: FORCE
|
||||
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
||||
cat doc/zerotier-cli.1 | gzip -9 >$(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
||||
cat doc/zerotier-idtool.1 | gzip -9 >$(DESTDIR)/usr/share/man/man1/zerotier-idtool.1.gz
|
||||
mkdir -p $(DESTDIR)/usr/lib/systemd/system
|
||||
rm -f $(DESTDIR)/usr/lib/systemd/system/zerotier-one.service
|
||||
cp -f ext/installfiles/linux/systemd/zerotier-one.service $(DESTDIR)/usr/lib/systemd/system
|
||||
|
||||
uninstall: FORCE
|
||||
rm -f $(DESTDIR)/var/lib/zerotier-one/zerotier-one
|
||||
@ -200,7 +197,6 @@ uninstall: FORCE
|
||||
rm -f $(DESTDIR)/usr/share/man/man8/zerotier-one.8.gz
|
||||
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-idtool.1.gz
|
||||
rm -f $(DESTDIR)/usr/share/man/man1/zerotier-cli.1.gz
|
||||
rm -f $(DESTDIR)/usr/lib/systemd/system/zerotier-one.service
|
||||
|
||||
debian: distclean
|
||||
debuild -I -i -us -uc
|
||||
|
Loading…
Reference in New Issue
Block a user