mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-08 03:50:48 +00:00
br2684ctl: convert init script to procd, add hotplug/reload support
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 47765
This commit is contained in:
parent
435e7fb295
commit
1d1265b40b
@ -178,8 +178,9 @@ define Package/atm-diagnostics/install
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/br2684ctl/install
|
define Package/br2684ctl/install
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/hotplug.d/atm
|
||||||
$(INSTALL_BIN) ./files/br2684ctl $(1)/etc/init.d/
|
$(INSTALL_BIN) ./files/br2684ctl $(1)/etc/init.d/
|
||||||
|
$(INSTALL_DATA) ./files/atm.hotplug $(1)/etc/hotplug.d/atm/00-trigger
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/br2684ctl $(1)/usr/sbin/
|
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/br2684ctl $(1)/usr/sbin/
|
||||||
endef
|
endef
|
||||||
|
1
package/network/utils/linux-atm/files/atm.hotplug
Normal file
1
package/network/utils/linux-atm/files/atm.hotplug
Normal file
@ -0,0 +1 @@
|
|||||||
|
ubus call service event '{ "type": "hotplug.atm", "data": { "name": "'"$DEVICENAME"'" } }'
|
@ -1,13 +1,9 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
START=50
|
START=50
|
||||||
|
USE_PROCD=1
|
||||||
SERVICE_DAEMONIZE=1
|
|
||||||
SERVICE_WRITE_PID=1
|
|
||||||
|
|
||||||
start_daemon() {
|
start_daemon() {
|
||||||
. /lib/functions/network.sh
|
|
||||||
|
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
|
|
||||||
local atmdev
|
local atmdev
|
||||||
@ -44,46 +40,47 @@ start_daemon() {
|
|||||||
local sendsize
|
local sendsize
|
||||||
config_get sendsize "$cfg" sendsize
|
config_get sendsize "$cfg" sendsize
|
||||||
|
|
||||||
|
found=
|
||||||
|
for device in /sys/class/atm/*; do
|
||||||
|
[ -d "$device" ] || break
|
||||||
|
[ "$(cat $device/atmindex)" = "$atmdev" ] || continue
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -n "$found" ] || return
|
||||||
|
|
||||||
local circuit="$atmdev.$vpi.$vci"
|
local circuit="$atmdev.$vpi.$vci"
|
||||||
|
|
||||||
network_defer_device "nas$unit"
|
procd_open_instance
|
||||||
|
procd_set_param command \
|
||||||
SERVICE_PID_FILE="/var/run/br2684ctl-$circuit.pid" \
|
/usr/sbin/br2684ctl \
|
||||||
service_start /usr/sbin/br2684ctl \
|
|
||||||
-c "$unit" -e "$encaps" -p "$payload" \
|
-c "$unit" -e "$encaps" -p "$payload" \
|
||||||
-a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"}
|
-a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"}
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
service_running() {
|
||||||
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
for path in /sys/class/net/nas*; do
|
||||||
network_ready_device "nas$unit"
|
dev="${path##*/}"
|
||||||
|
network_ready_device "$dev"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_daemon() {
|
service_triggers() {
|
||||||
local cfg="$1"
|
local script=$(readlink "$initscript")
|
||||||
|
local name=$(basename ${script:-$initscript})
|
||||||
|
|
||||||
local atmdev
|
procd_open_trigger
|
||||||
config_get atmdev "$cfg" atmdev 0
|
procd_add_raw_trigger hotplug.atm 2000 /etc/init.d/$name reload
|
||||||
|
procd_add_config_trigger "config.change" "$file" /etc/init.d/$name reload
|
||||||
local unit
|
procd_close_trigger
|
||||||
config_get unit "$cfg" unit 0
|
|
||||||
|
|
||||||
local vpi
|
|
||||||
config_get vpi "$cfg" vpi 8
|
|
||||||
|
|
||||||
local vci
|
|
||||||
config_get vci "$cfg" vci 35
|
|
||||||
|
|
||||||
local circuit="$atmdev.$vpi.$vci"
|
|
||||||
|
|
||||||
SERVICE_PID_FILE="/var/run/br2684ctl-$circuit.pid" \
|
|
||||||
service_stop /usr/sbin/br2684ctl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start_service() {
|
||||||
config_load network
|
config_load network
|
||||||
config_foreach start_daemon atm-bridge
|
config_foreach start_daemon atm-bridge
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
|
||||||
config_load network
|
|
||||||
config_foreach stop_daemon atm-bridge
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user