mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
travelmate: update 0.7.0
* no longer misuse ubus/procd service object for travelmate runtime information, now save all required information directly in a JSON file/format * new 'status' init command to print runtime information * add a configurable interface trigger timeout for nested & slow modem/router setups, set 'trm_triggerdelay' accordingly * change start priority & refine reload timings * cosmetics Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
@@ -1,21 +1,29 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=85
|
||||
START=35
|
||||
USE_PROCD=1
|
||||
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Print runtime information"
|
||||
|
||||
trm_init="/etc/init.d/travelmate"
|
||||
trm_script="/usr/bin/travelmate.sh"
|
||||
|
||||
boot()
|
||||
{
|
||||
ubus -t 30 wait_for network.interface
|
||||
trm_boot=1
|
||||
ubus -t 30 wait_for network.interface 2>/dev/null
|
||||
rc_procd start_service
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
if [ $(/etc/init.d/travelmate enabled; printf ${?}) -eq 0 ]
|
||||
if [ $("${trm_init}" enabled; printf ${?}) -eq 0 ]
|
||||
then
|
||||
if [ -n "${trm_boot}" ]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
procd_open_instance "travelmate"
|
||||
procd_set_param command "${trm_script}" "${@}"
|
||||
procd_set_param stdout 1
|
||||
@@ -24,13 +32,21 @@ start_service()
|
||||
fi
|
||||
}
|
||||
|
||||
status()
|
||||
{
|
||||
rc_procd "${trm_script}" status
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
local iface="$(uci -q get travelmate.global.trm_iface)"
|
||||
local delay="$(uci -q get travelmate.global.trm_triggerdelay)"
|
||||
|
||||
PROCD_RELOAD_DELAY=$((${delay:=2} * 1000))
|
||||
for name in ${iface}
|
||||
do
|
||||
procd_add_interface_trigger "interface.*.down" "${name}" "${trm_init}" start
|
||||
done
|
||||
PROCD_RELOAD_DELAY=1000
|
||||
procd_add_config_trigger "config.change" "travelmate" "${trm_init}" start
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user