2020-06-26 00:56:53 +00:00
|
|
|
From: Robert Fairley <rfairley@redhat.com>
|
|
|
|
Date: Wed, 17 Jun 2020 10:14:19 -0400
|
2021-04-22 10:32:13 +00:00
|
|
|
Subject: [PATCH] examples/nm-dispatcher.dhcp: use sysconfig
|
2020-06-26 00:56:53 +00:00
|
|
|
|
|
|
|
Use the PEERNTP and NTPSERVERARGS environment variables from
|
2021-04-22 10:32:13 +00:00
|
|
|
/etc/sysconfig/network{-scripts}.
|
2021-02-01 16:32:54 +00:00
|
|
|
|
|
|
|
Co-Authored-By: Christian Glombek <cglombek@redhat.com>
|
2020-06-26 00:56:53 +00:00
|
|
|
|
|
|
|
diff --git a/examples/chrony.nm-dispatcher.dhcp b/examples/chrony.nm-dispatcher.dhcp
|
2021-02-01 16:32:54 +00:00
|
|
|
index 6ea4c37..a6ad35a 100644
|
2020-06-26 00:56:53 +00:00
|
|
|
--- a/examples/chrony.nm-dispatcher.dhcp
|
|
|
|
+++ b/examples/chrony.nm-dispatcher.dhcp
|
2021-04-22 10:32:13 +00:00
|
|
|
@@ -6,16 +6,24 @@
|
2020-06-26 00:56:53 +00:00
|
|
|
|
2021-02-01 16:32:54 +00:00
|
|
|
chronyc=/usr/bin/chronyc
|
|
|
|
default_server_options=iburst
|
|
|
|
-server_dir=/var/run/chrony-dhcp
|
|
|
|
+server_dir=/run/chrony-dhcp
|
|
|
|
|
|
|
|
dhcp_server_file=$server_dir/$interface.sources
|
2020-06-26 00:56:53 +00:00
|
|
|
# DHCP4_NTP_SERVERS is passed from DHCP options by NetworkManager.
|
|
|
|
nm_dhcp_servers=$DHCP4_NTP_SERVERS
|
|
|
|
|
|
|
|
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
|
|
|
|
+[ -f /etc/sysconfig/network-scripts/ifcfg-"${interface}" ] && \
|
|
|
|
+ . /etc/sysconfig/network-scripts/ifcfg-"${interface}"
|
|
|
|
+
|
|
|
|
add_servers_from_dhcp() {
|
|
|
|
rm -f "$dhcp_server_file"
|
|
|
|
+
|
|
|
|
+ # Don't add NTP servers if PEERNTP=no specified; return early.
|
|
|
|
+ [ "$PEERNTP" = "no" ] && return
|
|
|
|
+
|
|
|
|
for server in $nm_dhcp_servers; do
|
|
|
|
- echo "server $server $default_server_options" >> "$dhcp_server_file"
|
|
|
|
+ echo "server $server ${NTPSERVERARGS:-$default_server_options}" >> "$dhcp_server_file"
|
|
|
|
done
|
|
|
|
$chronyc reload sources > /dev/null 2>&1 || :
|
|
|
|
}
|
|
|
|
--
|
2021-02-01 16:32:54 +00:00
|
|
|
2.29.2
|
2020-06-26 00:56:53 +00:00
|
|
|
|