automatic version update by autodist [release 1.29.1-1mamba;Sat Feb 01 2014]

This commit is contained in:
Automatic Build System 2024-01-05 21:20:33 +01:00
parent 679c61f119
commit 55532392cf
9 changed files with 777 additions and 0 deletions

View File

@ -1,2 +1,13 @@
# chrony # chrony
Chrony is a pair of programs which are used to maintain the accuracy of the system clock on a computer.
The two programs are called chronyd and chronyc.
Chronyd is a daemon which runs in background on the system.
It obtains measurements via the network of the system clocks offset relative to time servers on other systems and adjusts the system time accordingly.
For isolated systems, the user can periodically enter the correct time by hand (using Chronyc).
In either case, Chronyd determines the rate at which the computer gains or loses time, and compensates for this.
Chronyd implements the NTP protocol and can act as either a client or a server.
Chronyc provides a user interface to Chronyd for monitoring its performance and configuring various settings.
It can do so while running on the same computer as the Chronyd instance it is controlling or a different computer.

12
chrony-1.28-run-dir.patch Normal file
View File

@ -0,0 +1,12 @@
diff -Nru chrony-1.27.orig/conf.c chrony-1.27/conf.c
--- chrony-1.27.orig/conf.c 2013-02-01 15:47:43.000000000 +0100
+++ chrony-1.27/conf.c 2013-04-13 19:42:37.175845513 +0200
@@ -205,7 +205,7 @@
/* Filename to use for storing pid of running chronyd, to prevent multiple
* chronyds being started. */
-static char *pidfile = "/var/run/chronyd.pid";
+static char *pidfile = "/run/chronyd.pid";
/* Temperature sensor, update interval and compensation coefficients */
static char *tempcomp_file = NULL;

323
chrony-conf Normal file
View File

@ -0,0 +1,323 @@
#######################################################################
#
# This is an example chrony configuration file. You should copy it to
# /etc/chrony.conf after uncommenting and editing the options that you
# want to enable. The more obscure options are not included. Refer
# to the documentation for these.
#
# Copyright 2002 Richard P. Curnow
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
#######################################################################
### COMMENTS
# Any of the following lines are comments (you have a choice of
# comment start character):
# a comment
% a comment
! a comment
; a comment
#
# Below, the '!' form is used for lines that you might want to
# uncomment and edit to make your own chrony.conf file.
#
#######################################################################
#######################################################################
### SPECIFY YOUR NTP SERVERS
# Most computers using chrony will send measurement requests to one or
# more 'NTP servers'. You will probably find that your Internet Service
# Provider or company have one or more NTP servers that you can specify.
# Failing that, there are a lot of public NTP servers. There is a list
# you can access at
# http://www.eecis.udel.edu/~mills/ntp/servers.htm.
# pool.ntp.org
server 85.18.189.242
# europe.pool.ntp.org
server 87.32.0.19
# north-america.pool.ntp.org
server 63.240.161.99
! # asia.pool.ntp.org
! server 202.134.1.10
! # oceania.pool.ntp.org
! server 202.60.94.15
! # ntp1.ien.it
! server 193.204.114.232
! # ntp2.ien.it
! server 193.204.114.233
# However, for dial-up use you probably want these instead. The word
# 'offline' means that the server is not visible at boot time. Use
# chronyc's 'online' command to tell chronyd that these servers have
# become visible after you go on-line.
! server ntp0.your-isp.com offline
! server ntp1.your-isp.com offline
! server ntp.public-server.org offline
# You may want to specify NTP 'peers' instead. If you run a network
# with a lot of computers and want several computers running chrony to
# have the 'front-line' interface to the public NTP servers, you can
# 'peer' these machines together to increase robustness.
! peer ntp0.my-company.com
# There are other options to the 'server' and 'peer' directives that you
# might want to use. For example, you can ignore measurements whose
# round-trip-time is too large (indicating that the measurement is
# probably useless, because you don't know which way the measurement
# message got held up.) Consult the full documentation for details.
#######################################################################
### AVOIDING POTENTIALLY BOGUS CHANGES TO YOUR CLOCK
#
# To avoid changes being made to your computer's gain/loss compensation
# when the measurement history is too erratic, you might want to enable
# one of the following lines. The first seems good for dial-up (or
# other high-latency connections like slow leased lines), the second
# seems OK for a LAN environment.
! maxupdateskew 100
! maxupdateskew 5
#######################################################################
### FILENAMES ETC
# Chrony likes to keep information about your computer's clock in files.
# The 'driftfile' stores the computer's clock gain/loss rate in parts
# per million. When chronyd starts, the system clock can be tuned
# immediately so that it doesn't gain or lose any more time. You
# generally want this, so it is uncommented.
driftfile /etc/chrony.drift
# If you want to use the program called chronyc to configure aspects of
# chronyd's operation once it is running (e.g. tell it the Internet link
# has gone up or down), you need a password. This is stored in the
# following keys file. (You also need keys to support authenticated NTP
# exchanges between cooperating machines.) Again, this option is
# assumed by default.
keyfile /etc/chrony.keys
# Tell chronyd which numbered key in the file is used as the password
# for chronyc. (You can pick any integer up to 2**32-1. '1' is just a
# default. Using another value will _NOT_ increase security.)
commandkey 1
# chronyd can save the measurement history for the servers to files when
# it it exits. This is useful in 2 situations:
#
# 1. On Linux, if you stop chronyd and restart it with '-r' (e.g. after
# an upgrade), the old measurements will still be relevant when chronyd
# is restarted. This will reduce the time needed to get accurate
# gain/loss measurements, especially with a dial-up link.
#
# 2. Again on Linux, if you use the RTC support and start chronyd with
# '-r -s' on bootup, measurements from the last boot will still be
# useful (the real time clock is used to 'flywheel' chronyd between
# boots).
#
# Enable these two options to use this.
! dumponexit
! dumpdir /var/log/chrony
# chronyd writes its process ID to a file. If you try to start a second
# copy of chronyd, it will detect that the process named in the file is
# 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 /run/chronyd.pid
#######################################################################
### INITIAL CLOCK CORRECTION
# This option is only useful if your NTP servers are visible at boot
# time. This probably means you are on a LAN. If so, the following
# option will choose the best-looking of the servers and correct the
# system time to that. The value '10' means that if the error is less
# than 10 seconds, it will be gradually removed by speeding up or
# slowing down your computer's clock until it is correct. If the error
# is above 10 seconds, an immediate time jump will be applied to correct
# it. Some software can get upset if the system clock jumps (especially
# backwards), so be careful!
initstepslew 60 85.18.189.242 87.32.0.19 63.240.161.99
#######################################################################
### LOGGING
# If you want to log information about the time measurements chronyd has
# gathered, you might want to enable the following lines. You probably
# only need this if you really enjoy looking at the logs, you want to
# produce some graphs of your system's timekeeping performance, or you
# need help in debugging a problem.
! logdir /var/log/chrony
! log measurements statistics tracking
# If you have real time clock support enabled (see below), you might want
# this line instead:
! log measurements statistics tracking rtc
#######################################################################
### ACTING AS AN NTP SERVER
# You might want the computer to be an NTP server for other computers.
# e.g. you might be running chronyd on a dial-up machine that has a LAN
# sitting behind it with several 'satellite' computers on it.
#
# By default, chronyd does not allow any clients to access it. You need
# to explicitly enable access using 'allow' and 'deny' directives.
#
# e.g. to enable client access from the 192.168.*.* class B subnet,
! allow 192.168/16
# .. but disallow the 192.168.100.* subnet of that,
! deny 192.168.100/24
# You can have as many allow and deny directives as you need. The order
# is unimportant.
# If you want chronyd to act as an NTP broadcast server, enable and edit
# (and maybe copy) the following line. This means that a broadcast
# packet is sent to the address 192.168.1.255 every 60 seconds. The
# address MUST correspond to the broadcast address of one of the network
# interfaces on your machine. If you have multiple network interfaces,
# add a broadcast line for each.
! broadcast 60 192.168.1.255
# If you want to present your computer's time for others to synchronise
# with, even if you don't seem to be synchronised to any NTP servers
# yourself, enable the following line. The value 10 may be varied
# between 1 and 15. You should avoid small values because you will look
# like a real NTP server. The value 10 means that you appear to be 10
# NTP 'hops' away from an authoritative source (atomic clock, GPS
# receiver, radio clock etc).
! local stratum 10
# Normally, chronyd will keep track of how many times each client
# machine accesses it. The information can be accessed by the 'clients'
# command of chronyc. You can disable this facility by uncommenting the
# following line. This will save a bit of memory if you have many
# clients.
! noclientlog
# The clientlog size is limited to 512KB by default. If you have many
# clients, especially in many different subnets, you might want to
# increase the limit.
! clientloglimit 4194304
#######################################################################
### REPORTING BIG CLOCK CHANGES
# Perhaps you want to know if chronyd suddenly detects any large error
# in your computer's clock. This might indicate a fault or a problem
# with the server(s) you are using, for example.
#
# The next option causes a message to be written to syslog when chronyd
# has to correct an error above 0.5 seconds (you can use any amount you
# like).
! logchange 0.5
# The next option will send email to the named person when chronyd has
# to correct an error above 0.5 seconds. (If you need to send mail to
# several people, you need to set up a mailing list or sendmail alias
# for them and use the address of that.)
! mailonchange wibble@foobar.org 0.5
#######################################################################
### COMMAND ACCESS
# The program chronyc is used to show the current operation of chronyd
# and to change parts of its configuration whilst it is running.
# Normally, chronyd will only allow connections from chronyc on the same
# machine as itself. This is for security. If you have a subnet
# 192.168.*.* and you want to be able to use chronyc from any machine on
# it, you could uncomment the following line. (Edit this to your own
# situation.)
! cmdallow 192.168/16
# You can add as many 'cmdallow' and 'cmddeny' lines as you like. The
# syntax and meaning is the same as for 'allow' and 'deny', except that
# 'cmdallow' and 'cmddeny' control access to the chronyd's command port.
# NOTE, even if the host where you run chronyc is granted access, you
# still need a command key set up and you have to know the password to
# put into chronyc to allow you to modify chronyd's parameters. By
# default all you can do is view information about chronyd's operation.
# Some people have reported that the need the following line to allow
# chronyc to work even on the same machine. This should not be
# necessary, and the problem is being investigated. You can leave this
# line enabled, as it's benign otherwise.
cmdallow 127.0.0.1
#######################################################################
### REAL TIME CLOCK
# chronyd can characterise the system's real-time clock. This is the
# clock that keeps running when the power is turned off, so that the
# machine knows the approximate time when it boots again. The error at
# a particular epoch and gain/loss rate can be written to a file and
# used later by chronyd when it is started with the '-s' option.
#
# You need to have 'enhanced RTC support' compiled into your Linux
# kernel. (Note, these options apply only to Linux.)
! rtcfile /etc/chrony.rtc
# Your RTC can be set to keep Universal Coordinated Time (UTC) or local
# time. (Local time means UTC +/- the effect of your timezone.) If you
# use UTC, chronyd will function correctly even if the computer is off
# at the epoch when you enter or leave summer time (aka daylight saving
# time). However, if you dual boot your system with Microsoft Windows,
# that will work better if your RTC maintains local time. You take your
# pick!
! rtconutc
# By default chronyd assumes that the enhanced RTC device is accessed as
# /dev/rtc. If it's accessed somewhere else on your system (e.g. you're
# using devfs), uncomment and edit the following line.
! rtcdevice /dev/misc/rtc
#######################################################################
### REAL TIME SCHEDULER
# This directive tells chronyd to use the real-time FIFO scheduler with the
# specified priority (which must be between 0 and 100). This should result
# in reduced latency. You don't need it unless you really have a requirement
# for extreme clock stability. Works only on Linux. Note that the "-P"
# command-line switch will override this.
! sched_priority 1
#######################################################################
### LOCKING CHRONYD INTO RAM
# This directive tells chronyd to use the mlockall() syscall to lock itself
# into RAM so that it will never be paged out. This should result in reduced
# latency. You don't need it unless you really have a requirement
# for extreme clock stability. Works only on Linux. Note that the "-m"
# command-line switch will also enable this feature.
! lock_all

16
chrony-wait.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=Wait for chrony to synchronize system clock
After=chronyd.service
Requires=chronyd.service
Before=time-sync.target
Wants=time-sync.target
[Service]
Type=oneshot
# Wait up to ~10 minutes for chronyd to synchronize and the remaining
# clock correction to be less than 0.1 seconds
ExecStart=/usr/bin/chronyc waitsync 60 0.1
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

113
chrony.helper Normal file
View File

@ -0,0 +1,113 @@
#!/bin/bash
config=/etc/chrony.conf
keyfile=/etc/chrony.keys
chronyc=/usr/bin/chronyc
dhclient_servers=/var/lib/dhclient/chrony.servers.*
dhclient_added_servers=/var/lib/dhclient/chrony.added_servers
service_name=chronyd.service
get_key() {
awk '/^[ \t]*'$1'\>/ { if ($3 == "") print "MD5", $2;
else print $2, $3; exit }' < $keyfile
}
get_commandkeyid() {
awk '/^[ \t]*commandkey\>/ { keyid=$2 } END { print keyid }' < $config
}
chrony_command() {
commandkeyid=$(get_commandkeyid)
[ -z "$commandkeyid" ] && return 1
commandkey=$(get_key $commandkeyid)
[ -z "$commandkey" ] && return 2
authhash=${commandkey% *}
password=${commandkey#* }
$chronyc <<EOF
authhash $authhash
password $password
$1
EOF
}
generate_commandkey() {
commandkeyid=$(get_commandkeyid)
[ -z "$commandkeyid" ] && return 1
commandkey=$(get_key $commandkeyid)
[ -z "$commandkey" ] || return 0
password=$(tr -c -d '0-9A-F' < /dev/urandom | head -c 40)
[ ${#password} -eq 40 ] &&
echo "$commandkeyid SHA1 HEX:$password" >> $keyfile
}
update_dhclient_added_servers() {
new_servers=$(echo "$1" | sort -u)
old_servers=$(cat $dhclient_added_servers 2> /dev/null)
[ "$old_servers" = "$new_servers" ] && return 0
[ -n "$new_servers" ] && echo "$new_servers" > $dhclient_added_servers ||
rm -f $dhclient_added_servers
}
add_dhclient_servers() {
shopt -s nullglob
servers_files=($dhclient_servers)
shopt -u nullglob
(( ${#servers_files[*]} )) || return 0
added_servers=$(
cat $dhclient_added_servers 2> /dev/null
cat ${servers_files[*]} |
while read server serverargs; do
chrony_command "add server $server $serverargs" &> /dev/null &&
echo "$server"
done)
update_dhclient_added_servers "$added_servers"
}
remove_dhclient_servers() {
[ -f $dhclient_added_servers ] || return 0
all_servers=$(
cat $dhclient_servers 2> /dev/null |
while read server serverargs; do
echo "$server"
done | sort -u)
echo "$all_servers" | comm -23 $dhclient_added_servers - |
while read server; do
chrony_command "delete $server" &> /dev/null
done
added_servers=$(echo "$all_servers" | comm -12 $dhclient_added_servers -)
update_dhclient_added_servers "$added_servers"
}
is_running() {
systemctl is-active -q $service_name
}
case "$1" in
generate-commandkey)
generate_commandkey
;;
add-dhclient-servers)
add_dhclient_servers
;;
remove-dhclient-servers)
remove_dhclient_servers
;;
is-running)
is_running
;;
command)
is_running && chrony_command "$2"
;;
forced-command)
chrony_command "$2"
;;
*)
echo $"Usage: $0 {generate-commandkey|add-dhclient-servers|remove-dhclient-servers|is-running|command|forced-command}"
exit 2
esac
exit $?

198
chrony.spec Normal file
View File

@ -0,0 +1,198 @@
%define chrony_groupid 55
%define chrony_userid 55
Name: chrony
Version: 1.29.1
Release: 1mamba
Summary: A pair of programs which are used to maintain the accuracy of the system clock on a computer
Group: System/Servers
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://chrony.tuxfamily.org/index.html
Source: http://download.tuxfamily.org/chrony/chrony-%{version}.tar.gz
Source1: chrony-conf
Source2: chronyd-initscript
Source3: chronyd-nm-dispatcher
Source4: chrony-wait.service
Source5: chronyd.service
Source6: chrony.helper
Patch0: %{name}-1.28-run-dir.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libcap-devel
BuildRequires: libedit-devel
BuildRequires: libnss-devel
## AUTOBUILDREQ-END
BuildRequires: libncurses-devel
BuildRequires: libreadline-devel
Provides: ntp
Obsoletes: ntp
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
Chrony is a pair of programs which are used to maintain the accuracy of the system clock on a computer.
The two programs are called chronyd and chronyc.
Chronyd is a daemon which runs in background on the system.
It obtains measurements via the network of the system clocks offset relative to time servers on other systems and adjusts the system time accordingly.
For isolated systems, the user can periodically enter the correct time by hand (using Chronyc).
In either case, Chronyd determines the rate at which the computer gains or loses time, and compensates for this.
Chronyd implements the NTP protocol and can act as either a client or a server.
Chronyc provides a user interface to Chronyd for monitoring its performance and configuring various settings.
It can do so while running on the same computer as the Chronyd instance it is controlling or a different computer.
%prep
%setup -q
%patch0 -p1
%build
./configure --prefix=%{_prefix}
%make CC=%{_host}-gcc
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
install -D -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/chrony.conf
install -D -m0755 %{SOURCE2} %{buildroot}%{_initrddir}/chronyd
install -D -m0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/10_chronyd
install -d %{buildroot}%{_var}/log/chrony
# systemd stuff
install -d %{buildroot}/lib/systemd/system
install -m 0644 -p %{SOURCE4} %{buildroot}/lib/systemd/system/chrony-wait.service
install -m 0644 -p %{SOURCE5} %{buildroot}/lib/systemd/system/chronyd.service
install -D -m0755 -p %{SOURCE6} %{buildroot}%{_prefix}/libexec/chrony-helper
install -d -m0755 %{buildroot}%{_prefix}/lib/systemd/ntp-units.d
echo 'chronyd.service' > %{buildroot}%{_prefix}/lib/systemd/ntp-units.d/50-chronyd.list
rm -rf %{buildroot}%{_docdir}/chrony
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre
if [ $1 -ge 1 ]; then
/usr/sbin/groupadd chrony -g %{chrony_groupid} 2>/dev/null
/usr/sbin/useradd -u %{chrony_userid} -c 'Chrony daemon' -d /dev/null -g chrony \
-s /bin/false chrony 2>/dev/null
fi
:
%preun
if [ $1 -eq 0 ]; then
[ -x /sbin/service ] && /sbin/service chronyd stop
[ -x /sbin/chkconfig ] && /sbin/chkconfig --del chronyd
systemctl -q disable chronyd
systemctl -q daemon-reload
/usr/sbin/groupdel chrony 2>/dev/null
/usr/sbin/userdel chrony 2>/dev/null
fi
:
%post
if [ $1 -ge 1 ]; then
[ -e %{_sysconfdir}/chrony.drift ] || touch %{_sysconfdir}/chrony.drift
[ -e %{_sysconfdir}/chrony.keys ] || touch %{_sysconfdir}/chrony.keys
chown chrony.chrony %{_sysconfdir}/chrony.drift
chown chrony.chrony %{_sysconfdir}/chrony.keys
sed -i "s|/var/run/chronyd.pid|/run/chronyd.pid|" %{_sysconfdir}/chrony.conf
# service start/stop now managed by NetworkManager dispatcher
[ -x /sbin/chkconfig ] && /sbin/chkconfig --del chronyd
systemctl -q disable chronyd
systemctl -q daemon-reload
fi
:
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/chrony.conf
%{_sysconfdir}/NetworkManager/dispatcher.d/10_chronyd
%{_initrddir}/chronyd
%{_bindir}/chronyc
%{_sbindir}/chronyd
/lib/systemd/system/chrony-wait.service
/lib/systemd/system/chronyd.service
%{_prefix}/lib/systemd/ntp-units.d/50-chronyd.list
%{_prefix}/libexec/chrony-helper
%dir %{_var}/log/chrony
%{_mandir}/man1/chrony.*
%{_mandir}/man1/chronyc.*
%{_mandir}/man5/chrony.conf.*
%{_mandir}/man8/chronyd.*
%doc COPYING
#NEWS README chrony.txt examples/chrony.conf.example examples/chrony.keys.example
%changelog
* Sat Feb 01 2014 Automatic Build System <autodist@mambasoft.it> 1.29.1-1mamba
- automatic version update by autodist
* Thu Sep 26 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.29-4mamba
- chronyd-nm-dispatcher: removed forgotten debugging line
* Wed Sep 18 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.29-3mamba
- chronyd-nm-dispatcher: re-add check on default route removed by mistake in previous release
- chronyd-nm-dispatcher: start chronyd with "systemctl --no-block ..."
* Wed Sep 11 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.29-2mamba
- disable service to let is be started by NetworkManager dispatcher
- chronyd-nm-dispatcher: need to start here chronyd for big time adjust to be made
- chronyd-nm-dispatcher: unmaintain (remove) non systemd code
- chronyd.service: don't start after network service to allow it starting inside nm dispatcher
- chrony-wait.service: fix service name (was chron-wait.service)
* Fri Aug 09 2013 Automatic Build System <autodist@mambasoft.it> 1.29-1mamba
- automatic version update by autodist
* Fri Jul 19 2013 Automatic Build System <autodist@mambasoft.it> 1.28-1mamba
- automatic version update by autodist
* Fri Jun 14 2013 openmamba WebBuild System <webbuild@openmamba.org> 1.27-8mamba
- rework NetworkManager dispatcher script for systemd integration
* Tue May 07 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.27-7mamba
- post: fix permissions of chrony.drift and chrony.keys if they where created with root permissions by previous releases
* Sat Apr 13 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.27-6mamba
- patch to use /run instead of /var/run for pid
* Sat Apr 13 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.27-5mamba
- x86_64: install chrony-helper under /usr/libexec instead of /usr/libexec64
- NetworkManager dispatcher.d file: do nothing if systemd is running
* Wed Apr 03 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.27-4mamba
- provide a chrony user as requested by new systemd service script
- remove BindTo=systemd-timedated-ntp.target from chronyd.service for recent systemd
* Fri Mar 29 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.27-3mamba
- added systemd service files
* Mon Mar 25 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.27-2mamba
- update NetworkManager dispatcher.d startup file to check for ip route on the interface
* Sat Feb 02 2013 Automatic Build System <autodist@mambasoft.it> 1.27-1mamba
- automatic version update by autodist
* Mon Jul 25 2011 Automatic Build System <autodist@mambasoft.it> 1.26-1mamba
- automatic version update by autodist
* Sun Jun 19 2011 Automatic Build System <autodist@mambasoft.it> 1.25-1mamba
- automatic update by autodist
* Thu Apr 14 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.24-4mamba
- configure to use NetworkManager dispatcher to start/stop service
* Fri Dec 03 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 1.24-3mamba
- enable big adjustement on service startup for a skew > 60 sec
* Fri Oct 22 2010 Davide Madrisan <davide.madrisan@gmail.com> 1.24-2mamba
- create the directory %{_var}/log/chrony
* Fri Oct 15 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 1.24-1mamba
- package created by autospec

67
chronyd-initscript Normal file
View File

@ -0,0 +1,67 @@
#! /bin/bash
#
# chronyd Start/Stop the chronyd NTP daemon.
#
# chkconfig: 345 55 10
# description: chronyd is a daemon which obtains measurements via the network \
# of the system clocks offset relative to time servers on other \
# systems and adjusts the system time accordingly.
# processname: chronyd
# pidfile: /var/run/chronyd.pid
# Source function library.
. /etc/init.d/functions
RETVAL=0
prog="chronyd"
start() {
echo -n $"Starting $prog: "
daemon chronyd < /dev/null
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/chronyd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc chronyd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/chronyd
return $RETVAL
}
rhstatus() {
statusproc chronyd
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/chronyd ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
exit $?

23
chronyd-nm-dispatcher Normal file
View File

@ -0,0 +1,23 @@
#!/bin/sh
INTERFACE="$1" # The interface which is brought up or down
STATUS="$2" # The new state of the interface
case "$STATUS" in
'up') # $INTERFACE is up
# Check to see if the interface added a default route
/sbin/ip route list dev "$INTERFACE" 2>/dev/null | grep -q '^default' || exit 0
/usr/libexec/chrony-helper is-running
if [ $? -ne 0 ]; then
systemctl --no-block start chronyd
else
/usr/libexec/chrony-helper command online >/dev/null 2>&1
fi
;;
'down') # $INTERFACE is down
/sbin/ip route list 2>/dev/null | grep -q '^default' && exit 0
/usr/libexec/chrony-helper command offline > /dev/null 2>&1
;;
esac

14
chronyd.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=NTP client/server
After=syslog.target ntpdate.service
Conflicts=ntpd.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/chronyd
ExecStartPre=/usr/libexec/chrony-helper generate-commandkey
ExecStart=/usr/sbin/chronyd -u chrony $OPTIONS
ExecStartPost=/usr/libexec/chrony-helper add-dhclient-servers
[Install]
WantedBy=multi-user.target