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.

48 lines
959 B
Bash

#!/bin/sh
. /lib/functions.sh
. /usr/lib/configsync_lib.sh
CS_SERVICE=csghn
SERVICE=ghn
my_logger() {
logger -t configsync_executor "${CS_SERVICE}" "${@}"
}
system_to_configsync()
{
my_logger "This is ${0} system_to_configsync()!"
config_load ${SERVICE}
config_get VALUE ghn powersave
uci_cs set ${CS_SERVICE}.ghn.powersave="${VALUE}"
uci_cs commit ${CS_SERVICE}
return 0
}
init()
{
my_logger "This is ${0} init()!"
if [ ! -d ${CS_CONFIGURATION_PATH} ]; then
mkdir -p ${CS_CONFIGURATION_PATH}
fi
# clear the current CS config to avoid accidental merging
>${CS_CONFIGURATION_PATH}/${CS_SERVICE}
uci_cs set ${CS_SERVICE}.configsync=info
uci_cs set ${CS_SERVICE}.configsync.version=1
uci_cs set ${CS_SERVICE}.ghn=ghn
system_to_configsync init
}
if [ "${1}" = "init" ] || [ "${1}" = "system_to_configsync" ]; then
"${@}"
else
my_logger "Unknown command ${1} in ${0}!"
fi