@@ -17,4 +17,18 @@ config BR2_PACKAGE_CHRONY_DEBUG_LOGGING
enabled at runtime. If disabled, code for debug logging will
not be compiled in.
+config BR2_PACKAGE_CHRONY_NM_DHCP
+ bool "receive NTP sources from NetworkManager DHCP client"
+ depends on BR2_PACKAGE_NETWORK_MANAGER
+ help
+ Install a NetworkManager dispatcher script that writes NTP
+ servers received over DHCP to a per-interface sources file
+ and reloads sources, and add a "sourcedir" directive to use
+ those files to the default config.
+
+ Note that if you enable this option and override the default
+ chrony config (e.g. in an overlay) you need to make sure
+ that the "sourcedir /var/run/chrony-dhcp" directive remains
+ in effect.
+
endif
@@ -65,6 +65,13 @@ else
CHRONY_CONF_OPTS += --without-nettle
endif
+ifeq ($(BR2_PACKAGE_CHRONY_NM_DHCP),y)
+define CHRONY_INSTALL_NM_DHCP_CMDS
+ $(INSTALL) -D -m 755 $(@D)/examples/chrony.nm-dispatcher.dhcp $(TARGET_DIR)/etc/NetworkManager/dispatcher.d/chrony.dhcp
+ echo "sourcedir /var/run/chrony-dhcp" >>$(TARGET_DIR)/etc/chrony.conf
+endef
+endif
+
define CHRONY_CONFIGURE_CMDS
cd $(@D) && $(TARGET_CONFIGURE_OPTS) ./configure $(CHRONY_CONF_OPTS)
endef
@@ -76,6 +83,7 @@ endef
define CHRONY_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" install
$(INSTALL) -D -m 644 $(@D)/examples/chrony.conf.example2 $(TARGET_DIR)/etc/chrony.conf
+ $(CHRONY_INSTALL_NM_DHCP_CMDS)
endef
define CHRONY_INSTALL_INIT_SYSV
If the new BR2_PACKAGE_CHRONY_NM_DHCP option is enabled, chrony will automatically add NTP servers received over DHCP to its sources. This is particularly useful for devices without a battery-backed RTC, if the local DHCP (including DHCPv6) server announces nearby NTP servers. Signed-off-by: Fiona Klute <fiona.klute@gmx.de> --- package/chrony/Config.in | 14 ++++++++++++++ package/chrony/chrony.mk | 8 ++++++++ 2 files changed, 22 insertions(+)