emissary-firmware/files/etc/uci-defaults/99-emissary.sh

30 lines
602 B
Bash
Raw Normal View History

2023-02-03 16:40:47 +01:00
#/bin/sh
set -e
main() {
local default_config="/etc/emissary/default.conf"
if [ ! -f "${default_config}" ]; then
exit 0
fi
source "${default_config}"
if [ ! -z "${EMISSARY_RECONCILIATION_INTERVAL}" ]; then
uci set "emissary.agent.reconciliation_interval=${EMISSARY_RECONCILIATION_INTERVAL}"
fi
if [ ! -z "${EMISSARY_SERVER_URL}" ]; then
uci set "emissary.agent.server_url=${EMISSARY_SERVER_URL}"
fi
# Commit modifications
uci commit
# Delete file
rm -f "${default_config}"
/etc/init.d/emissary-agent enable
}
main