Skip to content

Commit 48fdcec

Browse files
committed
Add init file for wfb-ng-full openwrt package
1 parent 47a4d39 commit 48fdcec

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

openwrt/net/wfb-ng-full/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ define Py3Package/wfb-ng-full/install
5151
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wfb_tx $(1)/usr/bin/
5252
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wfb_tx_cmd $(1)/usr/bin/
5353
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wfb_keygen $(1)/usr/bin/
54+
$(INSTALL_DIR) $(1)/etc/init.d
55+
$(INSTALL_BIN) ./files/wfb-ng.init $(1)/etc/init.d/wfb-ng
5456
endef
5557

5658
$(eval $(call Py3Package,wfb-ng-full))
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh /etc/rc.common
2+
3+
START=99
4+
STOP=10
5+
6+
USE_PROCD=1
7+
NAME=wfb-ng
8+
9+
SYSUPGRADE_CONF="/etc/sysupgrade.conf"
10+
WFB_CFG="/etc/wifibroadcast.cfg"
11+
WFB_INIT="/usr/sbin/wfb-ng.sh"
12+
WFB_SERVER="/usr/bin/wfb-server --profiles gs --cluster manual"
13+
14+
if [ -f $SYSUPGRADE_CONF ] && [ -x $WFB_INIT ] && ! grep -q $WFB_INIT $SYSUPGRADE_CONF
15+
then
16+
echo $WFB_INIT >> $SYSUPGRADE_CONF
17+
fi
18+
19+
if [ -f $SYSUPGRADE_CONF ] && [ -f $WFB_CFG ] && ! grep -q $WFB_CFG $SYSUPGRADE_CONF
20+
then
21+
echo $WFB_CFG >> $SYSUPGRADE_CONF
22+
fi
23+
24+
start_service() {
25+
# start cluster node
26+
if [ -x $WFB_INIT ]; then
27+
procd_open_instance wfb-ng
28+
procd_set_param command $WFB_INIT
29+
procd_set_param respawn
30+
procd_set_param stdout 1
31+
procd_set_param stderr 1
32+
procd_close_instance
33+
fi
34+
35+
# start cluster manager
36+
if [ -f $WFB_CFG ]; then
37+
procd_open_instance wfb-ng-server
38+
procd_set_param command $WFB_SERVER
39+
procd_set_param respawn
40+
procd_set_param stdout 1
41+
procd_set_param stderr 1
42+
procd_close_instance
43+
fi
44+
}

0 commit comments

Comments
 (0)