aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-09-07 16:44:03 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-09-07 16:44:03 +0200
commit97bb92b35bdcf90bf1ddf9ad814a3df39f29c0a3 (patch)
tree2c815f4b00db5337f2331c876651731d7e26f189
downloadnetworkmanager-dispatcher-timesyncd-97bb92b35bdcf90bf1ddf9ad814a3df39f29c0a3.tar.gz
networkmanager-dispatcher-timesyncd-97bb92b35bdcf90bf1ddf9ad814a3df39f29c0a3.tar.zst
initial commit
-rwxr-xr-x30-timesyncd18
-rw-r--r--Makefile2
-rw-r--r--README.md4
3 files changed, 24 insertions, 0 deletions
diff --git a/30-timesyncd b/30-timesyncd
new file mode 100755
index 0000000..da0f193
--- /dev/null
+++ b/30-timesyncd
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+INTERFACE="${1}"
+STATUS="${2}"
+
+case "${STATUS}" in
+ up|dhcp4-change)
+ if [ -n "${DHCP4_NTP_SERVERS}" ]; then
+ mkdir -p /run/systemd/timesyncd.conf.d/
+ echo "[Time]" > /run/systemd/timesyncd.conf.d/${INTERFACE}.conf
+ echo "NTP = ${DHCP4_NTP_SERVERS}" >> /run/systemd/timesyncd.conf.d/${INTERFACE}.conf
+ fi
+ ;;
+ down)
+ rm -f /run/systemd/timesyncd.conf.d/${INTERFACE}.conf
+ ;;
+esac
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..68f4730
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,2 @@
+install: 30-timesyncd
+ install -D -m0755 30-timesyncd $(DESTDIR)/etc/NetworkManager/dispatcher.d/30-timesyncd
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4ff22f0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+networkmanager-dispatcher-timesyncd
+===================================
+
+Networkmanager Dispatcher script for systemd-timesyncd