addon-chrony/chrony/rootfs/etc/cont-init.d/20-configuration.sh
2019-03-20 08:41:11 -04:00

19 lines
696 B
Bash

#!/usr/bin/with-contenv bashio
# ==============================================================================
# Community Hass.io Add-ons: chrony
# This file configures the conf file from the options set
# ==============================================================================
readonly CHRONY_CONF='/etc/chrony/chrony.conf'
declare mode
declare -a serverlist
mode=$(bashio::config 'mode')
bashio::log.debug "Running in NTP mode: ${mode}"
for server in $(bashio::config "ntp_${mode}"); do
bashio::log.debug "Adding server ${server}"
echo "${mode} ${server} iburst" >> ${CHRONY_CONF}
serverlist+=("${server}")
done
echo "initstepslew 10 ${serverlist[*]}" >> ${CHRONY_CONF}