chrony: Update to 3.4
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
parent
a707963dd2
commit
9296f2a840
|
@ -1,68 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
config=/etc/chrony.conf
|
||||
keyfile=/etc/chrony.keys
|
||||
chronyc=/usr/bin/chronyc
|
||||
dhclient_servers=/var/lib/dhclient/chrony.servers.*
|
||||
service_name=chronyd.service
|
||||
|
||||
get_key() {
|
||||
awk '/^[ \t]*'$1'\>/ { print $2; 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
|
||||
|
||||
$chronyc <<EOF
|
||||
password $commandkey
|
||||
$1
|
||||
EOF
|
||||
}
|
||||
|
||||
generate_commandkey() {
|
||||
commandkeyid=$(get_commandkeyid)
|
||||
[ -z "$commandkeyid" ] && return 1
|
||||
commandkey=$(get_key $commandkeyid)
|
||||
[ -z "$commandkey" ] || return 0
|
||||
|
||||
commandkey=$(tr -c -d '[\041-\176]' < /dev/urandom | head -c 16)
|
||||
[ -n "$commandkey" ] && echo "$commandkeyid $commandkey" >> $keyfile
|
||||
}
|
||||
|
||||
add_dhclient_servers() {
|
||||
command=$(cat $dhclient_servers 2> /dev/null |
|
||||
while read server serverargs; do
|
||||
echo "add server $server $serverargs"
|
||||
done)
|
||||
if [ -n "$command" ]; then
|
||||
chrony_command "$command" &> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
is_running() {
|
||||
systemctl status chronyd.service &> /dev/null
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
generate-commandkey)
|
||||
generate_commandkey
|
||||
;;
|
||||
add-dhclient-servers)
|
||||
add_dhclient_servers
|
||||
;;
|
||||
command)
|
||||
is_running && chrony_command "$2"
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {generate-commandkey|add-dhclient-servers|command}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
|
|
@ -26,9 +26,6 @@ makestep 100 3
|
|||
|
||||
keyfile /etc/chrony.keys
|
||||
|
||||
# Specify the key used as password for chronyc.
|
||||
commandkey 1
|
||||
|
||||
# Disable logging of client accesses.
|
||||
noclientlog
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
SERVERFILE=$SAVEDIR/chrony.servers.$interface
|
||||
|
||||
chrony_config() {
|
||||
rm -f $SERVERFILE
|
||||
if [ "$PEERNTP" != "no" ]; then
|
||||
/usr/libexec/chrony-helper command "$(
|
||||
for server in $new_ntp_servers; do
|
||||
echo "add server $server $NTPSERVERARGS"
|
||||
echo "$server $NTPSERVERARGS" >> $SERVERFILE
|
||||
done)" &> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
chrony_restore() {
|
||||
if [ -f $SERVERFILE ]; then
|
||||
/usr/libexec/chrony-helper command "$(
|
||||
while read server serverargs; do
|
||||
echo "delete $server"
|
||||
done < $SERVERFILE)" &> /dev/null
|
||||
rm -f $SERVERFILE
|
||||
fi
|
||||
}
|
|
@ -4,11 +4,11 @@
|
|||
###############################################################################
|
||||
|
||||
name = chrony
|
||||
version = 1.26
|
||||
release = 9
|
||||
version = 3.4
|
||||
release = 1
|
||||
|
||||
groups = System/Daemons
|
||||
url = http://chrony.tuxfamily.org
|
||||
url = https://chrony.tuxfamily.org
|
||||
license = GPLv2
|
||||
summary = An NTP client/server.
|
||||
|
||||
|
@ -20,11 +20,14 @@ description
|
|||
clocks, system real-time clock or manual input as time references.
|
||||
end
|
||||
|
||||
source_dl = https://download.tuxfamily.org/chrony/
|
||||
|
||||
build
|
||||
requires
|
||||
bison
|
||||
libcap-devel
|
||||
libedit-devel
|
||||
nettle-devel
|
||||
readline-devel
|
||||
shadow-utils
|
||||
texinfo
|
||||
|
@ -50,17 +53,10 @@ build
|
|||
install -m 640 -p %{DIR_SOURCE}/chrony.keys %{BUILDROOT}/etc/chrony.keys
|
||||
chown -v root.chrony %{BUILDROOT}/etc/chrony.keys
|
||||
|
||||
mkdir -pv %{BUILDROOT}/etc/dhcp/dhclient.d
|
||||
install -m 755 -p %{DIR_SOURCE}/chrony.dhclient \
|
||||
%{BUILDROOT}/etc/dhcp/dhclient.d/chrony.sh
|
||||
|
||||
mkdir -pv %{BUILDROOT}/etc/logrotate.d
|
||||
install -m 644 -p %{DIR_SOURCE}/chrony.logrotate \
|
||||
%{BUILDROOT}/etc/logrotate.d/chrony
|
||||
|
||||
mkdir -pv %{BUILDROOT}/usr/lib/chrony
|
||||
install -m 755 -p %{DIR_SOURCE}/chrony-helper %{BUILDROOT}/usr/lib/chrony-helper
|
||||
|
||||
chown -Rv chrony.chrony %{BUILDROOT}/var/{lib,log}/chrony
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,9 +5,7 @@ Conflicts=ntpd.service
|
|||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/sysconfig/chronyd
|
||||
ExecStartPre=/usr/lib/chrony-helper generate-commandkey
|
||||
ExecStart=/usr/sbin/chronyd -n -u chrony $OPTIONS
|
||||
ExecStartPost=/usr/lib/chrony-helper add-dhclient-servers
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
Loading…
Reference in New Issue