Hi Michael,

On Wed, May 3, 2017 at 9:59 PM, Michael Biebl <bi...@debian.org> wrote:
> Hi Balint
>
> Am 03.05.2017 um 21:42 schrieb Balint Reczey:
>> Package: systemd
>> Version: 232-22
>> Severity: normal
>>
>> Dear Maintainers,
>>
>> When NetworkManager is running /etc/dhcp/dhclient-exit-hooks.d/timesyncd and
>> other hooks in the directory are not triggered. See #537358 for a very
>> old report
>> involving other packages with DHCP hooks.
>>
>> The widely adopted solution seems to be adding per-package scripts to
>> /etc/NetworkManager/dispatcher.d and the attached patch does that for 
>> systemd.
>>
>
> Aside some technical issues with the patch, I have to say I would prefer
> a different approach, see
> https://bugzilla.gnome.org/show_bug.cgi?id=746911

Yes, NM talking natively to systemd-timesyncd would be nice, indeed.
In case in the meantime you would give a shot to using the interface via
dispatcher.d to fix the regression I have updated the patch to basically match
ntp's existing solution.

Cheers,
Balint

-- 
Balint Reczey
Debian & Ubuntu Developer
From 5bdfd6e0dfd7d98c9513d6ae80023af5820eee3c Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint.rec...@canonical.com>
Date: Wed, 3 May 2017 17:44:05 +0200
Subject: [PATCH] Set timesyncd's NTP server from DHCP even with NetworkManager

LP: #1685484
---
 debian/extra/dispatcher.d/timesyncd | 12 ++++++++++++
 debian/systemd.install              |  1 +
 2 files changed, 13 insertions(+)
 create mode 100755 debian/extra/dispatcher.d/timesyncd

diff --git a/debian/extra/dispatcher.d/timesyncd b/debian/extra/dispatcher.d/timesyncd
new file mode 100755
index 0000000..b72fa0a
--- /dev/null
+++ b/debian/extra/dispatcher.d/timesyncd
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+old_ntp_servers="unknown and invalid"
+new_ntp_servers=$DHCP4_NTP_SERVERS
+case "$2" in
+    up|vpn-up) reason=BOUND; ;;
+    down|vpn-down) reason=RELEASE; ;;
+    *) exit 0; ;;
+esac
+
+test -f /etc/dhcp/dhclient-exit-hooks.d/timesyncd || exit 0
+. /etc/dhcp/dhclient-exit-hooks.d/timesyncd
diff --git a/debian/systemd.install b/debian/systemd.install
index b3e0594..905600c 100644
--- a/debian/systemd.install
+++ b/debian/systemd.install
@@ -65,5 +65,6 @@ var/lib
 ../../extra/systemd-sysv-install lib/systemd/
 ../../extra/units/* lib/systemd/system/
 ../../extra/dhclient-exit-hooks.d/ etc/dhcp/
+../../extra/dispatcher.d/ etc/NetworkManager/
 ../../extra/kernel-install.d/* usr/lib/kernel/install.d
 ../../extra/pam.d etc/
-- 
2.7.4

Reply via email to