Files
wlan-ap/feeds/ipq807x_v5.4/hostapd/files/afcd.init
2024-09-16 11:49:02 +02:00

44 lines
865 B
Bash

#!/bin/sh /etc/rc.common
START=19
USE_PROCD=1
NAME=afcd
PROG=/usr/bin/ucode
add_afc() {
config_get_bool disabled "$1" disabled 0
[ "$disabled" -gt 0 ] && return
config_get url "$1" url
config_get cert "$1" cert
[ -n "$url" ] || return
procd_open_instance afcd
procd_set_param command "$PROG" /usr/share/hostap/afcd.uc -u "$url"
[ -n "$cert" ] && procd_append_param command -c "$cert"
procd_set_param respawn
procd_close_instance
}
_afc_location() {
# create afc-location.json
procd_open_instance
procd_set_param command "$PROG" /usr/share/hostap/afc_location.uc
procd_set_param respawn
procd_close_instance
}
start_service() {
config_load wireless
config_foreach add_afc afc-server
local gps_disabled=$(uci get gps.@gps[-1].disabled)
[ "$gps_disabled" -eq 0 ] && _afc_location
}
service_triggers()
{
procd_add_reload_trigger wireless
}