travelmate: update 0.3.0

* switch to procd interface trigger
    * no additional active monitor/polling in the background
    * simplified code
* new option "trm_maxwait", how long (in seconds)
    should travelmate wait for wlan interface reload action
    (default: '20')
* documentation update

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken
2016-12-31 14:14:29 +01:00
parent 811bda6982
commit c4356a02d5
5 changed files with 161 additions and 250 deletions
+25 -11
View File
@@ -3,23 +3,37 @@
START=85
USE_PROCD=1
exec 2>/dev/null
trm_script="/usr/bin/travelmate.sh"
trm_iface="$(uci -q get travelmate.global.trm_iface)"
boot()
{
ubus -t 30 wait_for network.interface
rc_procd start_service
}
start_service()
{
ubus -t 30 wait_for network.wireless
if [ $(($?)) -eq 0 ]
then
procd_open_instance
procd_set_param command "${trm_script}"
procd_close_instance
else
logger -s "travelmate [procd]:" "no wlan devices found, travelmate startup canceled"
fi
procd_open_instance "travelmate"
procd_set_param env trm_procd="true"
procd_set_param command "${trm_script}" "${@}"
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
service_triggers()
{
procd_add_reload_trigger "travelmate"
local iface
procd_add_config_trigger "config.change" "travelmate" /etc/init.d/travelmate start
if [ -z "${trm_iface}" ]
then
procd_add_raw_trigger "interface.*.down" 1000 /etc/init.d/travelmate start
else
for iface in ${trm_iface}
do
procd_add_interface_trigger "interface.*.down" "${iface}" /etc/init.d/travelmate start
done
fi
}