diff -Nru ntp-4.2.8p10+dfsg/debian/changelog ntp-4.2.8p10+dfsg/debian/changelog --- ntp-4.2.8p10+dfsg/debian/changelog 2017-09-05 13:09:08.000000000 +0000 +++ ntp-4.2.8p10+dfsg/debian/changelog 2017-10-04 18:33:45.000000000 +0000 @@ -1,3 +1,10 @@ +ntp (1:4.2.8p10+dfsg-5ubuntu3) artful; urgency=medium + + * d/ntp.dhcp add support for parsing systemd networkd lease files LP: + #1717983 + + -- Dimitri John Ledkov Tue, 03 Oct 2017 01:54:33 +0100 + ntp (1:4.2.8p10+dfsg-5ubuntu2) artful; urgency=medium * d/ntp-systemd-wrapper protect systemd service startup from concurrent diff -Nru ntp-4.2.8p10+dfsg/debian/ntp.dhcp ntp-4.2.8p10+dfsg/debian/ntp.dhcp --- ntp-4.2.8p10+dfsg/debian/ntp.dhcp 2017-09-05 13:09:08.000000000 +0000 +++ ntp-4.2.8p10+dfsg/debian/ntp.dhcp 2017-10-04 18:33:45.000000000 +0000 @@ -17,12 +17,14 @@ ntp_servers_setup_add() { - if [ -e $NTP_DHCP_CONF ] && [ "$new_ntp_servers" = "$old_ntp_servers" ]; then + networkd_ntp=$(sed -n 's/NTP=//p' /run/systemd/netif/leases/* 2>/dev/null) + + if [ -z "$new_ntp_servers" ] && [ -z "$networkd_ntp" ]; then + ntp_servers_setup_remove return fi - if [ -z "$new_ntp_servers" ]; then - ntp_servers_setup_remove + if [ -e $NTP_DHCP_CONF ] && [ "$new_ntp_servers" = "$old_ntp_servers" ] && [ -z "$networkd_ntp" ] ; then return fi @@ -36,7 +38,7 @@ echo "# here will be lost at the next DHCP event. Edit $NTP_CONF instead." echo echo "# NTP server entries received from DHCP server" - for server in $new_ntp_servers; do + for server in $new_ntp_servers $networkd_ntp; do echo "server $server iburst" done echo diff -Nru ntp-4.2.8p10+dfsg/debian/ntp-systemd-netif.path ntp-4.2.8p10+dfsg/debian/ntp-systemd-netif.path --- ntp-4.2.8p10+dfsg/debian/ntp-systemd-netif.path 1970-01-01 00:00:00.000000000 +0000 +++ ntp-4.2.8p10+dfsg/debian/ntp-systemd-netif.path 2017-10-04 18:33:45.000000000 +0000 @@ -0,0 +1,8 @@ +[Unit] +DefaultDependencies=no + +[Path] +PathChanged=/run/systemd/netif/leases + +[Install] +WantedBy=network-pre.target diff -Nru ntp-4.2.8p10+dfsg/debian/ntp-systemd-netif.service ntp-4.2.8p10+dfsg/debian/ntp-systemd-netif.service --- ntp-4.2.8p10+dfsg/debian/ntp-systemd-netif.service 1970-01-01 00:00:00.000000000 +0000 +++ ntp-4.2.8p10+dfsg/debian/ntp-systemd-netif.service 2017-10-04 18:33:45.000000000 +0000 @@ -0,0 +1,4 @@ +[Service] +Environment=reason=BOUND +ExecStart=/bin/sh -c '. /etc/dhcp/dhclient-exit-hooks.d/ntp' + diff -Nru ntp-4.2.8p10+dfsg/debian/rules ntp-4.2.8p10+dfsg/debian/rules --- ntp-4.2.8p10+dfsg/debian/rules 2017-09-05 13:09:08.000000000 +0000 +++ ntp-4.2.8p10+dfsg/debian/rules 2017-10-04 18:33:45.000000000 +0000 @@ -36,6 +36,8 @@ install -D -m 0755 debian/ntp.networkmanager debian/ntp/etc/NetworkManager/dispatcher.d/ntp install -D -m 0644 debian/ntpdate.dhcp debian/ntpdate/etc/dhcp/dhclient-exit-hooks.d/ntpdate install -D -m 0755 debian/ntpdate-debian debian/ntpdate/usr/sbin/ntpdate-debian + install -D -m 0644 debian/ntp-systemd-netif.path debian/ntp/lib/systemd/system/ntp-systemd-netif.path + install -D -m 0644 debian/ntp-systemd-netif.service debian/ntp/lib/systemd/system/ntp-systemd-netif.service install -D -m 0644 debian/ntp.conf debian/ntp/etc/ntp.conf @@ -56,6 +58,7 @@ rm -f debian/ntp-doc/usr/share/doc/ntp-doc/html/hints/solaris* override_dh_installinit: + dh_systemd_start -pntp ntp-systemd-netif.path dh_installinit -pntp --error-handler=installinit_error --no-restart-after-upgrade dh_installinit -pntpdate --no-restart-after-upgrade dh_apparmor --profile-name=usr.sbin.ntpd -pntp