summaryrefslogtreecommitdiffstats
path: root/debian/chrony.dhcp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-09 12:48:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-09 12:48:03 +0000
commit6d46de912288f0875f0e3cca27b8d7455fa07b42 (patch)
treeb2ee235051d590490c0fdccbf0241b3706e292e7 /debian/chrony.dhcp
parentAdding upstream version 4.5. (diff)
downloadchrony-6d46de912288f0875f0e3cca27b8d7455fa07b42.tar.xz
chrony-6d46de912288f0875f0e3cca27b8d7455fa07b42.zip
Adding debian version 4.5-1.debian/4.5-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/chrony.dhcp')
-rw-r--r--debian/chrony.dhcp27
1 files changed, 27 insertions, 0 deletions
diff --git a/debian/chrony.dhcp b/debian/chrony.dhcp
new file mode 100644
index 0000000..f3dacd7
--- /dev/null
+++ b/debian/chrony.dhcp
@@ -0,0 +1,27 @@
+CHRONY_SOURCEDIR=/run/chrony-dhcp
+SERVERFILE=$CHRONY_SOURCEDIR/$interface.sources
+
+chrony_config() {
+ rm -f "$SERVERFILE"
+ mkdir -p "$CHRONY_SOURCEDIR"
+ for server in $new_ntp_servers; do
+ echo "server $server iburst" >> "$SERVERFILE"
+ done
+ /usr/bin/chronyc reload sources > /dev/null 2>&1 || :
+}
+
+chrony_restore() {
+ if [ -f "$SERVERFILE" ]; then
+ rm -f "$SERVERFILE"
+ /usr/bin/chronyc reload sources > /dev/null 2>&1 || :
+ fi
+}
+
+case $reason in
+ BOUND|RENEW|REBIND|REBOOT)
+ chrony_config
+ ;;
+ EXPIRE|FAIL|RELEASE|STOP)
+ chrony_restore
+ ;;
+esac