From 48fdcec351a1fe25c0b43eef0295188dc44e1847 Mon Sep 17 00:00:00 2001 From: Vasily Evseenko Date: Sat, 21 Sep 2024 14:22:31 +0300 Subject: [PATCH] Add init file for wfb-ng-full openwrt package --- openwrt/net/wfb-ng-full/Makefile | 2 ++ openwrt/net/wfb-ng-full/files/wfb-ng.init | 44 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 openwrt/net/wfb-ng-full/files/wfb-ng.init diff --git a/openwrt/net/wfb-ng-full/Makefile b/openwrt/net/wfb-ng-full/Makefile index 70bb15bb..1f70fb30 100644 --- a/openwrt/net/wfb-ng-full/Makefile +++ b/openwrt/net/wfb-ng-full/Makefile @@ -51,6 +51,8 @@ define Py3Package/wfb-ng-full/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/wfb_tx $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/wfb_tx_cmd $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/wfb_keygen $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/wfb-ng.init $(1)/etc/init.d/wfb-ng endef $(eval $(call Py3Package,wfb-ng-full)) diff --git a/openwrt/net/wfb-ng-full/files/wfb-ng.init b/openwrt/net/wfb-ng-full/files/wfb-ng.init new file mode 100755 index 00000000..0febb96a --- /dev/null +++ b/openwrt/net/wfb-ng-full/files/wfb-ng.init @@ -0,0 +1,44 @@ +#!/bin/sh /etc/rc.common + +START=99 +STOP=10 + +USE_PROCD=1 +NAME=wfb-ng + +SYSUPGRADE_CONF="/etc/sysupgrade.conf" +WFB_CFG="/etc/wifibroadcast.cfg" +WFB_INIT="/usr/sbin/wfb-ng.sh" +WFB_SERVER="/usr/bin/wfb-server --profiles gs --cluster manual" + +if [ -f $SYSUPGRADE_CONF ] && [ -x $WFB_INIT ] && ! grep -q $WFB_INIT $SYSUPGRADE_CONF +then + echo $WFB_INIT >> $SYSUPGRADE_CONF +fi + +if [ -f $SYSUPGRADE_CONF ] && [ -f $WFB_CFG ] && ! grep -q $WFB_CFG $SYSUPGRADE_CONF +then + echo $WFB_CFG >> $SYSUPGRADE_CONF +fi + +start_service() { + # start cluster node + if [ -x $WFB_INIT ]; then + procd_open_instance wfb-ng + procd_set_param command $WFB_INIT + procd_set_param respawn + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance + fi + + # start cluster manager + if [ -f $WFB_CFG ]; then + procd_open_instance wfb-ng-server + procd_set_param command $WFB_SERVER + procd_set_param respawn + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance + fi +}