update chrony

This commit is contained in:
chengyechun 2023-01-31 14:35:17 +08:00
parent ddb3ee7a94
commit 56fcf705ea
6 changed files with 32 additions and 14 deletions

Binary file not shown.

BIN
chrony-4.3.tar.gz Normal file

Binary file not shown.

View File

@ -7,20 +7,23 @@ Use the PEERNTP and NTPSERVERARGS environment variables from
Co-Authored-By: Christian Glombek <cglombek@redhat.com> Co-Authored-By: Christian Glombek <cglombek@redhat.com>
---
examples/chrony.nm-dispatcher.dhcp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/examples/chrony.nm-dispatcher.dhcp b/examples/chrony.nm-dispatcher.dhcp diff --git a/examples/chrony.nm-dispatcher.dhcp b/examples/chrony.nm-dispatcher.dhcp
index 6ea4c37..a6ad35a 100644 index 547ce83..f23756e 100644
--- a/examples/chrony.nm-dispatcher.dhcp --- a/examples/chrony.nm-dispatcher.dhcp
+++ b/examples/chrony.nm-dispatcher.dhcp +++ b/examples/chrony.nm-dispatcher.dhcp
@@ -6,16 +6,24 @@ @@ -10,13 +10,21 @@ action=$2
chronyc=/usr/bin/chronyc chronyc=/usr/bin/chronyc
default_server_options=iburst server_options=iburst
-server_dir=/var/run/chrony-dhcp -server_dir=/var/run/chrony-dhcp
+server_dir=/run/chrony-dhcp +server_dir=/run/chrony-dhcp
dhcp_server_file=$server_dir/$interface.sources dhcp_server_file=$server_dir/$interface.sources
# DHCP4_NTP_SERVERS is passed from DHCP options by NetworkManager. dhcp_ntp_servers="$DHCP4_NTP_SERVERS $DHCP6_DHCP6_NTP_SERVERS"
nm_dhcp_servers=$DHCP4_NTP_SERVERS
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network +[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
+[ -f /etc/sysconfig/network-scripts/ifcfg-"${interface}" ] && \ +[ -f /etc/sysconfig/network-scripts/ifcfg-"${interface}" ] && \
@ -32,12 +35,18 @@ index 6ea4c37..a6ad35a 100644
+ # Don't add NTP servers if PEERNTP=no specified; return early. + # Don't add NTP servers if PEERNTP=no specified; return early.
+ [ "$PEERNTP" = "no" ] && return + [ "$PEERNTP" = "no" ] && return
+ +
for server in $nm_dhcp_servers; do for server in $dhcp_ntp_servers; do
- echo "server $server $default_server_options" >> "$dhcp_server_file" # Check for invalid characters (from the DHCPv6 NTP FQDN suboption)
+ echo "server $server ${NTPSERVERARGS:-$default_server_options}" >> "$dhcp_server_file" len1=$(printf '%s' "$server" | wc -c)
@@ -25,7 +33,7 @@ add_servers_from_dhcp() {
continue
fi
- printf 'server %s %s\n' "$server" "$server_options" >> "$dhcp_server_file"
+ printf 'server %s %s\n' "$server" "${NTPSERVERARGS:-$server_options}" >> "$dhcp_server_file"
done done
$chronyc reload sources > /dev/null 2>&1 || : $chronyc reload sources > /dev/null 2>&1 || :
} }
-- --
2.29.2 2.23.0

View File

@ -1,8 +1,8 @@
%global clknetsim_ver 470b5e %global clknetsim_ver f00531
Name: chrony Name: chrony
Version: 4.2 Version: 4.3
Release: 3 Release: 1
Summary: An NTP client/server Summary: An NTP client/server
License: GPLv2 License: GPLv2
URL: https://chrony.tuxfamily.org URL: https://chrony.tuxfamily.org
@ -13,8 +13,7 @@ Source6: https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknet
Patch1: chrony-nm-dispatcher-dhcp.patch Patch1: chrony-nm-dispatcher-dhcp.patch
Patch2: chrony-services.patch Patch2: chrony-services.patch
BuildRequires: gcc gcc-c++ bison systemd libcap-devel libedit-devel nettle-devel pps-tools-devel libseccomp-devel BuildRequires: gcc gcc-c++ bison systemd libcap-devel libedit-devel nettle-devel pps-tools-devel libseccomp-devel m4
Requires: shadow-utils systemd timedatex Requires: shadow-utils systemd timedatex
%description %description
@ -29,6 +28,10 @@ service to other computers in the network.
%prep %prep
%autosetup -p1 -n %{name}-%{version} -a 6 %autosetup -p1 -n %{name}-%{version} -a 6
# regenerate the file from getdate.y
rm -f getdate.c
mv clknetsim-%{clknetsim_ver}* test/simulation/clknetsim mv clknetsim-%{clknetsim_ver}* test/simulation/clknetsim
%build %build
@ -135,6 +138,12 @@ fi
%{_mandir}/man[158]/%{name}*.[158]* %{_mandir}/man[158]/%{name}*.[158]*
%changelog %changelog
* Mon Jan 30 2023 chengyechun <chengyechun1@huawei.com> - 4.3-1
- Type:enhancement
- ID:NA
- SUG:na
- DESC:update to chrony-4.3
* Sat Dec 24 2022 chengyechun <chengyechun1@huawei.com> - 4.2-3 * Sat Dec 24 2022 chengyechun <chengyechun1@huawei.com> - 4.2-3
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA

Binary file not shown.

BIN
clknetsim-f00531.tar.gz Normal file

Binary file not shown.