chrony/chrony.dhclient
Miroslav Lichvar 0ecc1e4fe9 switch to sourcedir directive for loading servers from DHCP
Drop the chrony-helper script in favor of the new sourcedir directive.

Modify the dhclient script to save NTP servers from DHCP to
/run/chrony-dhcp/$interface.sources and configure chronyd to (re)load
the sources from files in that directory on start and the "reload
sources" command.

Other functionality of the helper script is dropped with no
replacemement.
2020-08-26 09:39:23 +02:00

23 lines
505 B
Bash

#!/bin/bash
CHRONY_SOURCEDIR=/run/chrony-dhcp
SERVERFILE=$CHRONY_SOURCEDIR/$interface.sources
chrony_config() {
rm -f "$SERVERFILE"
if [ "$PEERNTP" != "no" ]; then
mkdir -p $CHRONY_SOURCEDIR
for server in $new_ntp_servers; do
echo "server $server ${NTPSERVERARGS:-iburst}" >> "$SERVERFILE"
done
/usr/bin/chronyc reload sources > /dev/null 2>&1 || :
fi
}
chrony_restore() {
if [ -f "$SERVERFILE" ]; then
rm -f "$SERVERFILE"
/usr/bin/chronyc reload sources > /dev/null 2>&1 || :
fi
}