mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
- uci-default script to detect based on env variable `netmode=extender` to disable obuspc.
37 lines
699 B
Bash
37 lines
699 B
Bash
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
# exit if running in an extender
|
|
enabled="$(uci -q get uspc.global.enabled)"
|
|
if [ "$enabled" -eq 0 ]; then
|
|
return 0;
|
|
fi
|
|
|
|
get_oui_from_db()
|
|
{
|
|
db -q get device.deviceinfo.ManufacturerOUI
|
|
}
|
|
|
|
get_serial_from_db()
|
|
{
|
|
db -q get device.deviceinfo.SerialNumber
|
|
}
|
|
|
|
fix_agent_endpoint()
|
|
{
|
|
local AgentEndpointID serial oui user pass
|
|
|
|
# Get endpoint id from obuspa config first
|
|
config_load obuspa
|
|
config_get AgentEndpointID localagent EndpointID ""
|
|
if [ -z "${AgentEndpointID}" ]; then
|
|
serial=$(get_serial_from_db)
|
|
oui=$(get_oui_from_db)
|
|
AgentEndpointID="os::${oui}-${serial//+/%2B}"
|
|
fi
|
|
|
|
uci -q set uspc.agent.EndpointID="${AgentEndpointID}"
|
|
}
|
|
|
|
fix_agent_endpoint
|