2020-10-14 20:49:42 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
CHRONY_SOURCEDIR=/run/chrony-dhcp
|
|
|
|
SERVERFILE=$CHRONY_SOURCEDIR/$interface.sources
|
|
|
|
|
|
|
|
chrony_config() {
|
2021-05-26 13:46:14 +00:00
|
|
|
# Disable modifications if called from a NM dispatcher script
|
|
|
|
[ -n "$NM_DISPATCHER_ACTION" ] && return 0
|
|
|
|
|
2020-10-14 20:49:42 +00:00
|
|
|
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() {
|
2021-05-26 13:46:14 +00:00
|
|
|
[ -n "$NM_DISPATCHER_ACTION" ] && return 0
|
|
|
|
|
2020-10-14 20:49:42 +00:00
|
|
|
if [ -f "$SERVERFILE" ]; then
|
|
|
|
rm -f "$SERVERFILE"
|
|
|
|
/usr/bin/chronyc reload sources > /dev/null 2>&1 || :
|
|
|
|
fi
|
|
|
|
}
|