mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 17:42:41 +00:00
37 lines
732 B
Bash
Executable File
37 lines
732 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
|
|
START=98
|
|
USE_PROCD=1
|
|
PROG=/usr/bin/cloud_discovery
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger ucentral
|
|
}
|
|
|
|
reload_service() {
|
|
ubus call cloud reload
|
|
}
|
|
|
|
start_service() {
|
|
[ -f /etc/ucentral/capabilities.json ] || {
|
|
mkdir -p /etc/ucentral/
|
|
/usr/share/ucentral/capabilities.uc
|
|
}
|
|
|
|
local valid=$(cat /etc/ucentral/gateway.json | jsonfilter -e '@["valid"]')
|
|
[ "$valid" == "true" ] ||
|
|
/usr/share/ucentral/ucentral.uc /etc/ucentral/ucentral.cfg.0000000001 > /dev/null
|
|
|
|
[ "$(fw_printenv -n pki2)" -eq 1 ] || {
|
|
/etc/init.d/cloud_discover disable
|
|
return
|
|
}
|
|
|
|
/etc/init.d/firstcontact disable
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$PROG"
|
|
procd_set_param respawn
|
|
procd_close_instance
|
|
}
|