summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorVincent Blut <vincent.debian@free.fr>2018-09-19 20:05:09 +0200
committerVincent Blut <vincent.debian@free.fr>2018-09-19 20:05:09 +0200
commit975533cb08d892b6369961719dfeab71aabe460f (patch)
tree2b2ae5113d9b57425d4bb3f726e325316b87e00a /examples
parent063fa09309219e1b95bf7d1b70b3c1983c8ab4c6 (diff)
New upstream version 3.4
Diffstat (limited to 'examples')
-rw-r--r--examples/chrony.conf.example32
-rw-r--r--examples/chrony.keys.example7
-rw-r--r--examples/chrony.nm-dispatcher36
-rw-r--r--examples/chrony.spec46
-rw-r--r--examples/chronyd.service2
5 files changed, 13 insertions, 80 deletions
diff --git a/examples/chrony.conf.example3 b/examples/chrony.conf.example3
index 05a4e98..c04f871 100644
--- a/examples/chrony.conf.example3
+++ b/examples/chrony.conf.example3
@@ -95,7 +95,7 @@ driftfile /var/lib/chrony/drift
# still running and bail out. If you want to change the path to the PID
# file, uncomment this line and edit it. The default path is shown.
-! pidfile /var/run/chronyd.pid
+! pidfile /var/run/chrony/chronyd.pid
# If the system timezone database is kept up to date and includes the
# right/UTC timezone, chronyd can use it to determine the current
diff --git a/examples/chrony.keys.example b/examples/chrony.keys.example
index 2dd19cd..65b6be2 100644
--- a/examples/chrony.keys.example
+++ b/examples/chrony.keys.example
@@ -1,6 +1,7 @@
-# This is an example chrony keys file. It is used for NTP authentication with
-# symmetric keys. It should be readable only by root or the user to which
-# chronyd is configured to switch to after start.
+# This is an example chrony keys file. It enables authentication of NTP
+# packets with symmetric keys when its location is specified by the keyfile
+# directive in chrony.conf(5). It should be readable only by root and the
+# user under which chronyd is running.
#
# Don't use the example keys! It's recommended to generate random keys using
# the chronyc keygen command.
diff --git a/examples/chrony.nm-dispatcher b/examples/chrony.nm-dispatcher
index a609a66..0b0c3e7 100644
--- a/examples/chrony.nm-dispatcher
+++ b/examples/chrony.nm-dispatcher
@@ -1,37 +1,15 @@
#!/bin/sh
-# This is a NetworkManager dispatcher script for chronyd to set its NTP sources
-# online or offline when a network interface is configured or removed
+# This is a NetworkManager dispatcher / networkd-dispatcher script for
+# chronyd to set its NTP sources online or offline when a network interface
+# is configured or removed
export LC_ALL=C
-[ "$2" != "up" ] && [ "$2" != "down" ] && exit 0
+# For NetworkManager consider only up/down events
+[ $# -ge 2 ] && [ "$2" != "up" ] && [ "$2" != "down" ] && exit 0
-# Check if there is a default route
+# Note: for networkd-dispatcher routable.d ~= on and off.d ~= off
-if /sbin/ip route list 2> /dev/null | grep -q '^default'; then
- chronyc online > /dev/null 2>&1
- exit 0
-fi
-
-sources=$(chronyc -c -n sources 2> /dev/null)
-
-[ $? -ne 0 ] && exit 0
-
-# Check each configured source if it has a route
-
-echo "$sources" | while IFS=, read mode state address rest; do
- [ "$mode" != '^' ] && [ "$mode" != '=' ] && continue
-
- /sbin/ip route get "$address" > /dev/null 2>&1 && command="online" || command="offline"
-
- # Set priority of sources so that the selected source is set as
- # last if offline to avoid unnecessary reselection
- [ "$state" != '*' ] && priority=1 || priority=2
-
- echo "$priority $command $address"
-
-done | sort | while read priority command address; do
- echo "$command $address"
-done | chronyc > /dev/null 2>&1
+chronyc onoffline > /dev/null 2>&1
exit 0
diff --git a/examples/chrony.spec b/examples/chrony.spec
deleted file mode 100644
index 8d03d09..0000000
--- a/examples/chrony.spec
+++ /dev/null
@@ -1,46 +0,0 @@
-%global chrony_version 3.3
-%if 0%(echo %{chrony_version} | grep -q pre && echo 1)
-%global prerelease %(echo %{chrony_version} | sed 's/.*-//')
-%endif
-Summary: An NTP client/server
-Name: chrony
-Version: %(echo %{chrony_version} | sed 's/-.*//')
-Release: %{!?prerelease:1}%{?prerelease:0.1.%{prerelease}}
-Source: chrony-%{version}%{?prerelease:-%{prerelease}}.tar.gz
-License: GPLv2
-Group: Applications/Utilities
-BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(id -u -n)
-
-%description
-chrony is a client and server for the Network Time Protocol (NTP).
-This program keeps your computer's clock accurate. It was specially
-designed to support systems with intermittent Internet connections,
-but it also works well in permanently connected environments. It can
-also use hardware reference clocks, the system real-time clock, or
-manual input as time references.
-
-%prep
-%setup -q -n %{name}-%{version}%{?prerelease:-%{prerelease}}
-
-%build
-./configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --sbindir=%{_sbindir} \
- --mandir=%{_mandir}
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
-
-%files
-%{_sbindir}/chronyd
-%{_bindir}/chronyc
-%{_mandir}/man1/chronyc.1.gz
-%{_mandir}/man5/chrony.conf.5.gz
-%{_mandir}/man8/chronyd.8.gz
-%doc README FAQ NEWS COPYING
-%doc examples/chrony.conf.example*
-%doc examples/chrony.keys.example
-
diff --git a/examples/chronyd.service b/examples/chronyd.service
index 4ffe3b1..1777413 100644
--- a/examples/chronyd.service
+++ b/examples/chronyd.service
@@ -7,7 +7,7 @@ ConditionCapability=CAP_SYS_TIME
[Service]
Type=forking
-PIDFile=/var/run/chronyd.pid
+PIDFile=/var/run/chrony/chronyd.pid
EnvironmentFile=-/etc/sysconfig/chronyd
ExecStart=/usr/sbin/chronyd $OPTIONS
PrivateTmp=yes