mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
[17.01] travelmate: release 1.0.2
* bump travelmate version in stable tree Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
@@ -1,39 +1,73 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=85
|
||||
START=25
|
||||
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
|
||||
ubus -t 30 wait_for network.interface network.wireless 2>/dev/null
|
||||
rc_procd start_service
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
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
|
||||
if [ $("${trm_init}" enabled; printf "%u" ${?}) -eq 0 ]
|
||||
then
|
||||
procd_open_instance "travelmate"
|
||||
procd_set_param command "${trm_script}" "${@}"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
local rtfile="$(uci -q get travelmate.global.trm_rtfile)"
|
||||
|
||||
rtfile="${rtfile:-"/tmp/trm_runtime.json"}"
|
||||
> "${rtfile}"
|
||||
rc_procd start_service
|
||||
}
|
||||
|
||||
status()
|
||||
{
|
||||
local key keylist value rtfile="$(uci_get travelmate.global.trm_rtfile)"
|
||||
|
||||
rtfile="${rtfile:-"/tmp/trm_runtime.json"}"
|
||||
if [ -s "${rtfile}" ]
|
||||
then
|
||||
printf "%s\n" "::: travelmate runtime information"
|
||||
json_load "$(cat "${rtfile}" 2>/dev/null)"
|
||||
json_select data
|
||||
json_get_keys keylist
|
||||
for key in ${keylist}
|
||||
do
|
||||
json_get_var value "${key}"
|
||||
printf " + %-18s : %s\n" "${key}" "${value}"
|
||||
done
|
||||
else
|
||||
printf "%s\n" "::: no travelmate runtime information available"
|
||||
fi
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
local iface="$(uci -q get travelmate.global.trm_iface)"
|
||||
local auto="$(uci_get travelmate.global.trm_automatic)"
|
||||
|
||||
if [ -z "${iface}" ]
|
||||
if [ "${auto}" = "0" ]
|
||||
then
|
||||
procd_add_raw_trigger "interface.*.down" 1000 /etc/init.d/travelmate start
|
||||
else
|
||||
for name in ${iface}
|
||||
do
|
||||
procd_add_interface_trigger "interface.*.down" "${name}" /etc/init.d/travelmate start
|
||||
done
|
||||
fi
|
||||
local trigger="$(uci_get travelmate.global.trm_iface)"
|
||||
local delay="$(uci_get travelmate.global.trm_triggerdelay)"
|
||||
|
||||
procd_add_config_trigger "config.change" "travelmate" /etc/init.d/travelmate start
|
||||
PROCD_RELOAD_DELAY=$((${delay:-2} * 1000))
|
||||
procd_add_interface_trigger "interface.*.down" "${trigger}" "${trm_init}" start
|
||||
fi
|
||||
procd_add_reload_trigger "travelmate"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user