2019-05-07 12:12:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-11-20 13:37:06 +00:00
|
|
|
CHRONY_SOURCEDIR=/run/chrony-dhcp
|
|
|
|
SERVERFILE=$CHRONY_SOURCEDIR/$interface.sources
|
2019-05-07 12:12:44 +00:00
|
|
|
|
|
|
|
chrony_config() {
|
2021-11-09 10:08:33 +00:00
|
|
|
# Disable modifications if called from a NM dispatcher script
|
|
|
|
[ -n "$NM_DISPATCHER_ACTION" ] && return 0
|
|
|
|
|
2019-11-05 21:27:18 +00:00
|
|
|
rm -f "$SERVERFILE"
|
2019-05-07 12:12:44 +00:00
|
|
|
if [ "$PEERNTP" != "no" ]; then
|
2024-11-20 13:37:06 +00:00
|
|
|
mkdir -p $CHRONY_SOURCEDIR
|
2019-05-07 12:12:44 +00:00
|
|
|
for server in $new_ntp_servers; do
|
2024-11-20 13:37:06 +00:00
|
|
|
echo "server $server ${NTPSERVERARGS:-iburst}" >> "$SERVERFILE"
|
2019-05-07 12:12:44 +00:00
|
|
|
done
|
2024-11-20 13:37:06 +00:00
|
|
|
/usr/bin/chronyc reload sources > /dev/null 2>&1 || :
|
2019-05-07 12:12:44 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
chrony_restore() {
|
2021-11-09 10:08:33 +00:00
|
|
|
[ -n "$NM_DISPATCHER_ACTION" ] && return 0
|
|
|
|
|
2019-11-05 21:27:18 +00:00
|
|
|
if [ -f "$SERVERFILE" ]; then
|
|
|
|
rm -f "$SERVERFILE"
|
2024-11-20 13:37:06 +00:00
|
|
|
/usr/bin/chronyc reload sources > /dev/null 2>&1 || :
|
2019-05-07 12:12:44 +00:00
|
|
|
fi
|
|
|
|
}
|