2010-04-29 13:50:56 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-08-25 13:10:11 +00:00
|
|
|
CHRONY_SOURCEDIR=/run/chrony-dhcp
|
|
|
|
SERVERFILE=$CHRONY_SOURCEDIR/$interface.sources
|
2010-04-29 13:50:56 +00:00
|
|
|
|
|
|
|
chrony_config() {
|
2019-05-23 07:50:28 +00:00
|
|
|
rm -f "$SERVERFILE"
|
2010-04-29 13:50:56 +00:00
|
|
|
if [ "$PEERNTP" != "no" ]; then
|
2020-08-25 13:10:11 +00:00
|
|
|
mkdir -p $CHRONY_SOURCEDIR
|
2012-02-10 16:22:48 +00:00
|
|
|
for server in $new_ntp_servers; do
|
2020-08-25 13:10:11 +00:00
|
|
|
echo "server $server ${NTPSERVERARGS:-iburst}" >> "$SERVERFILE"
|
2012-02-10 16:22:48 +00:00
|
|
|
done
|
2020-08-25 13:10:11 +00:00
|
|
|
/usr/bin/chronyc reload sources > /dev/null 2>&1 || :
|
2010-04-29 13:50:56 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
chrony_restore() {
|
2019-05-23 07:50:28 +00:00
|
|
|
if [ -f "$SERVERFILE" ]; then
|
|
|
|
rm -f "$SERVERFILE"
|
2020-08-25 13:10:11 +00:00
|
|
|
/usr/bin/chronyc reload sources > /dev/null 2>&1 || :
|
2010-04-29 13:50:56 +00:00
|
|
|
fi
|
|
|
|
}
|