mirror of
https://github.com/hassio-addons/addon-chrony.git
synced 2025-05-05 03:31:25 +00:00
19 lines
696 B
Bash
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}
|