You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.2 KiB
Plaintext

4 years ago
#!/bin/sh
. /lib/functions.sh
. /usr/lib/configsync_lib.sh
CS_SERVICE=cssystem
SERVICE=system
PSERVICE=${CS_PREFIX}${SERVICE}
my_logger() {
logger -t configsync_executor "${CS_SERVICE}" "${@}"
}
configsync_to_system()
{
# make working copy and get values from there step by step
uci_cs export $CS_SERVICE | uci_tmp import $CS_SERVICE
my_logger "This is ${0} configsync_to_system()!"
VALUE=$(uci_tmp get ${CS_SERVICE}.ntp.enabled)
uci_tmp set ${PSERVICE}.ntp.enabled="${VALUE}"
VALUE=$(uci_tmp get ${CS_SERVICE}.ntp.enable_server)
uci_tmp set ${PSERVICE}.ntp.enable_server="${VALUE}"
# an uci list, the trick is to use eval set
eval set -- "$(uci_tmp get ${CS_SERVICE}.ntp.server)"
uci_tmp delete ${PSERVICE}.ntp.server
for VALUE in "${@}"; do
uci_tmp add_list ${PSERVICE}.ntp.server="${VALUE}"
done
add_to_list $CS_IMPORTSERVICELIST ${SERVICE}
}
dynamic_update()
{
my_logger "This is ${0} dynamic_update()!"
}
init()
{
my_logger "This is ${0} init()!"
}
if [ "${1}" = "init" ] || [ "${1}" = "configsync_to_system" ] || [ "${1}" = "dynamic_update" ]; then
"${@}"
else
my_logger "Unknown command ${1} in ${0}!"
fi