diff options
-rw-r--r-- | network/chrony/README | 49 | ||||
-rw-r--r-- | network/chrony/chrony.SlackBuild | 24 | ||||
-rw-r--r-- | network/chrony/chrony.conf | 6 | ||||
-rw-r--r-- | network/chrony/chrony.info | 8 | ||||
-rw-r--r-- | network/chrony/doinst.sh | 23 | ||||
-rw-r--r-- | network/chrony/rc.chrony | 45 | ||||
-rw-r--r-- | network/chrony/slack-desc | 12 |
7 files changed, 143 insertions, 24 deletions
diff --git a/network/chrony/README b/network/chrony/README index b34ffa30b9..23bbc1c4ee 100644 --- a/network/chrony/README +++ b/network/chrony/README @@ -1,12 +1,43 @@ -Chrony is a pair of programs which are used to maintain the accuracy -of the real time clock on a computer via the NTP protocol. +chrony is a versatile implementation of the Network Time Protocol (NTP). It +can synchronise the system clock with NTP servers, reference clocks (e.g. +GPS receiver), and manual input using wristwatch and keyboard. It can also +operate as an NTPv4 (RFC 5905) server and peer to provide a time service to +other computers in the network. -Chrony can serve as both an NTP client for a single computer and as an NTP -server for other computers. +It is designed to perform well in a wide range of conditions, including +intermittent network connections, heavily congested networks, changing +temperatures (ordinary computer clocks are sensitive to temperature), and +systems that do not run continuously, or run on a virtual machine. -See http://chrony.tuxfamily.org/ for more details. +Two programs are included in chrony, chronyd is a daemon that is started at +boot time and chronyc is a command-line interface program which can be used +to monitor chronyd's performance and to change various operating parameters +whilst it is running. -Note: Because each installation's configuration will differ, the SlackBuild -script does not build or install configuration files. See the man pages for -chronyd and chrony.conf (and the contrib and examples directories) for -relevant configuration information. +Note 1: +You must have the 'chrony' group and user to run this script: + $ groupadd -g 354 chrony + $ useradd -u 354 -d /var/lib/chrony -s /bin/false -g chrony chrony +Feel free to use a different uid and gid if desired, but 354 is recommended +to avoid conflicts with other stuff from SlackBuilds.org. + +Note 2: +If you are upgrading from previous version, where the daemon was running +under 'root' user as opposed to 'chrony' user, you need to ensure correct +permissions for /var/run/chrony directory and files under /var/lib/chrony +directory. + +If possible (i.e. you don't have any precious files there), before starting +the daemon, remove /var/run/chrony directory (cronyd will recreate it) and +remove files under /var/lib/chrony directory (cronyd will recreate them). + +Note 3: +The provided configuration file sets up chrony to operate in the most common +scenario, that is NTP client for synchronising local machine time with the +remote NTP server(s) time (using pool.ntp.org by default). See the man pages +for chronyd and chrony.conf (and the contrib and examples directories) for +more details on possible configuration options. + +Note 4: +The provided /etc/rc.d/rc.chrony script can be used to launch the daemon at +boot and to stop it at shutdown. diff --git a/network/chrony/chrony.SlackBuild b/network/chrony/chrony.SlackBuild index 59c1d4f56b..572a856cec 100644 --- a/network/chrony/chrony.SlackBuild +++ b/network/chrony/chrony.SlackBuild @@ -1,8 +1,8 @@ #!/bin/sh -# Slackware build script for Chrony +# Slackware build script for chrony -# Copyright 2015-2016 Richard Ellis (USA) +# Copyright 2015-2018 Richard Ellis (USA) # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -23,7 +23,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=chrony -VERSION=${VERSION:-2.4} +VERSION=${VERSION:-3.2} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -56,6 +56,13 @@ fi set -e +if ! getent group chrony 2>&1 > /dev/null || \ + ! getent passwd chrony 2>&1 > /dev/null; then + echo "You must have a \"chrony\" user and group in order to run this script." + echo "See the included README for a suggested UID/GID." + exit 1 +fi + rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP @@ -69,6 +76,7 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +CC=${CC:-gcc} \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ @@ -76,11 +84,16 @@ CXXFLAGS="$SLKCFLAGS" \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/man \ - --docdir=/usr/doc/$PRGNAM-$VERSION + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --with-user=chrony make make install DESTDIR=$PKG +chown chrony:chrony $PKG/var/lib/chrony +install -D -m 0644 $CWD/chrony.conf $PKG/etc/chrony.conf.new +install -D -m 0644 $CWD/rc.chrony $PKG/etc/rc.d/rc.chrony.new + find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true @@ -88,11 +101,12 @@ find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a COPYING INSTALL README NEWS contrib/ examples/ $PKG/usr/doc/$PRGNAM-$VERSION +cp -a contrib/ examples/ COPYING FAQ INSTALL NEWS README $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/chrony/chrony.conf b/network/chrony/chrony.conf new file mode 100644 index 0000000000..8afbc23132 --- /dev/null +++ b/network/chrony/chrony.conf @@ -0,0 +1,6 @@ +pool pool.ntp.org iburst +driftfile /var/lib/chrony/drift +makestep 1.0 3 +rtcsync +hwclockfile /etc/adjtime +cmdport 0 diff --git a/network/chrony/chrony.info b/network/chrony/chrony.info index 6d9f8327ca..cbcfc276ae 100644 --- a/network/chrony/chrony.info +++ b/network/chrony/chrony.info @@ -1,8 +1,8 @@ PRGNAM="chrony" -VERSION="2.4" -HOMEPAGE="http://chrony.tuxfamily.org/" -DOWNLOAD="https://download.tuxfamily.org/chrony/chrony-2.4.tar.gz" -MD5SUM="d0598aa8a9be8faccef9386f6fc0d5f2" +VERSION="3.2" +HOMEPAGE="https://chrony.tuxfamily.org/" +DOWNLOAD="https://download.tuxfamily.org/chrony/chrony-3.2.tar.gz" +MD5SUM="f4c4eb0dc92f35ee4bb7d3dcd8029ecb" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" diff --git a/network/chrony/doinst.sh b/network/chrony/doinst.sh new file mode 100644 index 0000000000..21cb7905f6 --- /dev/null +++ b/network/chrony/doinst.sh @@ -0,0 +1,23 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + rm $NEW + fi +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +config etc/chrony.conf.new +preserve_perms etc/rc.d/rc.chrony.new diff --git a/network/chrony/rc.chrony b/network/chrony/rc.chrony new file mode 100644 index 0000000000..d165cb5c72 --- /dev/null +++ b/network/chrony/rc.chrony @@ -0,0 +1,45 @@ +#!/bin/sh + +################################################################################ +chronyd_start() { +################################################################################ + if [ -n "$(pidof chronyd)" ]; then + echo "chronyd seems to be already running." + else + echo "Starting chronyd: /usr/sbin/chronyd -u chrony" + /usr/sbin/chronyd -u chrony + fi +} + +################################################################################ +chronyd_stop() { +################################################################################ + if [ -z "$(pidof chronyd)" ]; then + echo "chronyd does not seem to be running." + else + echo "Stopping chronyd..." + kill $(cat /var/run/chronyd.pid) + fi +} + +################################################################################ +chronyd_restart() { +################################################################################ + if [ -n "$(pidof chronyd)" ]; then + chronyd_stop + sleep 1 + fi + + chronyd_start +} + +case "$1" in + 'start') + chronyd_start ;; + 'stop') + chronyd_stop ;; + 'restart') + chronyd_restart ;; + *) + echo "usage: $0 start|stop|restart" ;; +esac diff --git a/network/chrony/slack-desc b/network/chrony/slack-desc index 4f441d5c37..06b6f10907 100644 --- a/network/chrony/slack-desc +++ b/network/chrony/slack-desc @@ -8,12 +8,12 @@ |-----handy-ruler------------------------------------------------------| chrony: chrony (maintains accuracy of the real time clock via NTP) chrony: -chrony: Chrony is a pair of programs which are used to maintain the accuracy -chrony: of the real time clock on a computer. The two programs are called -chrony: chronyd and chronyc. -chrony: -chrony: See http://chrony.tuxfamily.org/ for more details. -chrony: +chrony: chrony is a versatile implementation of the Network Time Protocol. +chrony: It can synchronise the system clock with NTP servers, reference +chrony: clocks (e.g. GPS receiver), and manual input using wristwatch and +chrony: keyboard. It can also operate as an NTPv4 (RFC 5905) server and peer +chrony: to provide a time service to other computers in the network. chrony: +chrony: Homepage: https://chrony.tuxfamily.org/ chrony: chrony: |