mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			Merge pull request #315 from themactep/zerotier
re-use config from web ui plugin. no config means no zerotier, anyway.pull/316/head
						commit
						ca3169ba5e
					
				|  | @ -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 | ||||
|  |  | |||
|  | @ -1 +0,0 @@ | |||
| daemon=0 | ||||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue