diff options
-rw-r--r-- | nonsystemd/chrony-openrc/PKGBUILD | 26 | ||||
-rw-r--r-- | nonsystemd/chrony-openrc/chrony.confd | 17 | ||||
-rw-r--r-- | nonsystemd/chrony-openrc/chrony.initd | 78 |
3 files changed, 121 insertions, 0 deletions
diff --git a/nonsystemd/chrony-openrc/PKGBUILD b/nonsystemd/chrony-openrc/PKGBUILD new file mode 100644 index 000000000..546e25c08 --- /dev/null +++ b/nonsystemd/chrony-openrc/PKGBUILD @@ -0,0 +1,26 @@ +# Maintainer: Nathan Owens <ndowens@artixlinux.org> + +pkgname=chrony-openrc +pkgver=20210506 +pkgrel=2 +pkgdesc="OpenRC chrony init" +arch=('any') +url="https://gitea.artixlinux.org/artixlinux/packages-openrc" +license=('GPL2') +groups=('openrc-galaxy') +provides=('init-chrony' 'init-timed') +depends=('openrc' 'chrony') +conflicts=('init-chrony' 'init-timed') +backup=('etc/conf.d/chrony') +source=("chrony.confd" + "chrony.initd") +sha256sums=('e65e4cf13bf00d6e7378f86f4513b5b3312b1d8b181bedbef6d8f55e8037f1de' + '149b12adabd0ab5358de1b3d8674dd5ecde7acd7d14310ee83dae4a72bc84f0b') +b2sums=('496483539b15a55c15287178b7df730fe33fe8d7ceda164f362c0dd6cd833bbee84a0a0496586489659075fc10aafed0f221fb78d60804ddd9edd24e71f6d49b' + '4e8f80b060bcc7f6f3b0d702f1b85387f6e545c31f315232574bf8ebd5ad2a6604a80a994ba629ffe419776a29339d894f0c1c7db78e9cd6fb4dc4761cf2c398') + + +package() { + install -Dm755 "${srcdir}"/chrony.initd "${pkgdir}"/etc/init.d/chrony + install -Dm644 "${srcdir}"/chrony.confd "${pkgdir}"/etc/conf.d/chrony +} diff --git a/nonsystemd/chrony-openrc/chrony.confd b/nonsystemd/chrony-openrc/chrony.confd new file mode 100644 index 000000000..3c0f5abc4 --- /dev/null +++ b/nonsystemd/chrony-openrc/chrony.confd @@ -0,0 +1,17 @@ +# /etc/conf.d/chronyd + +CFGFILE="/etc/chrony.conf" + +# chronyd takes some time to perform a second fork, by enabling this +# option chronyd is deamonized through start-stop-daemon(1) thereby +# significantly reducing the startup time. +FAST_STARTUP=yes + +# Configuration dependant options : +# -s - Set system time from RTC if rtcfile directive present +# -r - Reload sample histories if dumponexit directive present +# +# The combination of "-s -r" allows chronyd to perform long term averaging of +# the gain or loss rate across system reboots and shutdowns. + +ARGS="" diff --git a/nonsystemd/chrony-openrc/chrony.initd b/nonsystemd/chrony-openrc/chrony.initd new file mode 100644 index 000000000..ce7b079c2 --- /dev/null +++ b/nonsystemd/chrony-openrc/chrony.initd @@ -0,0 +1,78 @@ +#!/usr/bin/openrc-run +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/chrony/files/chronyd.rc,v 1.8 2007/03/22 14:32:09 tove Exp $ + +command="/usr/bin/chronyd" +description="NTP daemon" +pidfile="/run/chrony/chronyd.pid" + +depend() { + need net + after firewall + provide ntp-client ntp-server + use dns +} + +checkconfig() { + # Note that /etc/chrony/chrony.keys is *NOT* checked. This + # is because the user may have specified another key + # file, and we don't want to force the user to use that + # exact name for the key file. + if [ ! -f "${CFGFILE}" ] ; then + eerror "Please create ${CFGFILE} and the" + eerror "chrony key file (usually /etc/chrony/chrony.keys)" + eerror "by using the" + eerror "" + eerror " chrony.conf.example" + eerror " chrony.keys.example" + eerror "" + eerror "files (from the documentation directory)" + eerror "as templates." + return 1 + else + # Actually, I tried it, and chrony seems to ignore the pidfile + # option. I'm going to leave it here anyway, since you never + # know if it might be handy + _cfg_pidfile=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"` + if [ -n "$_cfg_pidfile" ] ; then + pidfile="$_cfg_pidfile" + fi + fi + return 0 +} + +setxtrarg() { + if [ -c /dev/rtc ]; then + grep -q '^rtcfile' "${CFGFILE}" && ARGS="${ARGS} -s" + fi + grep -q '^dumponexit$' "${CFGFILE}" && ARGS="${ARGS} -r" + return 0 +} + +start() { + checkconfig || return $? + setxtrarg + + local daemon_args= + if yesno "$FAST_STARTUP"; then + ARGS="${ARGS} -n" + daemon_args="--background" + fi + + ebegin "Starting chronyd" + start-stop-daemon $daemon_args --start --quiet \ + --exec "${command}" \ + --pidfile "${pidfile}" \ + -- -f "${CFGFILE}" ${ARGS} + eend $? "Failed to start chronyd" +} + +stop() { + checkconfig || return $? + + ebegin "Stopping chronyd" + start-stop-daemon --stop --quiet \ + --pidfile "${pidfile}" + eend $? "Failed to stop chronyd" +} |