emissary-firmware/misc/emissary/uci-defaults/99-emissary.sh

30 lines
603 B
Bash

#/bin/sh
set -e
main() {
local default_config="/data/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