re-use config from web ui plugin. no config means no zerotier, anyway.

pull/315/head
Paul Philippov 2022-08-05 01:50:50 -04:00
parent a5a39aa1b3
commit 98b1459dfe
3 changed files with 23 additions and 21 deletions

View File

@ -3,22 +3,28 @@
# Start zerotier-one
#
config_file=/etc/webui/zerotier.conf
[ ! -f "$config_file" ] && echo "Config file not found." && exit 2
source $config_file
case "$1" in
start)
if grep -q daemon=1 /etc/zerotier.conf; then
echo "Starting zerotier-one daemon..."
/sbin/modprobe tun
/usr/sbin/zerotier-one -d
else
echo "Zerotier-One service disabled in zerotier.conf..."
fi
;;
stop)
echo "Stopping zerotier-one daemon..."
kill -9 $(pidof zerotier-one)
/sbin/rmmod -w tun
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
start)
if [ "true" = "$zerotier_enabled" ]; then
echo "Starting zerotier-one daemon..."
/sbin/modprobe tun
/usr/sbin/zerotier-one -d
else
echo "Zerotier-One service is disabled in ${config_file}."
exit 3
fi
;;
stop)
echo "Stopping zerotier-one daemon..."
kill -9 $(pidof zerotier-one)
/sbin/rmmod -w tun
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@ -1 +0,0 @@
daemon=0

View File

@ -20,9 +20,6 @@ endef
define ZEROTIER_ONE_INSTALL_TARGET_CMDS
$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc
cp ../general/package/zerotier-one/files/zerotier.conf $(TARGET_DIR)/etc
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
cp ../general/package/zerotier-one/files/S90zerotier $(TARGET_DIR)/etc/init.d
endef