summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjc_gargma <jc_gargma@iserlohn-fortress.net>2018-10-31 02:09:22 -0700
committerjc_gargma <jc_gargma@iserlohn-fortress.net>2018-10-31 02:09:22 -0700
commit046f50435b7b3f5fe3daddbb6569f6873813e6fd (patch)
treeb3b2e57cb6626d52ad1af743e4487a6e2306c348
parentRemoved broken sed command | Swapped /sbin with /usr/bin (diff)
downloadchrony-openrc-046f50435b7b3f5fe3daddbb6569f6873813e6fd.tar.xz
Fixed chronyd so that stopping works
-rw-r--r--PKGBUILD10
-rw-r--r--chronyd.confd4
-rw-r--r--chronyd.initd67
3 files changed, 14 insertions, 67 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 4698e0f..6a4007e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,9 +5,11 @@
# Gentoo version doesn't drop to custom user
# Gentoo version doesn't forbid ipv6
# Gentoo version uses /usr/sbin
+# Gentoo version sets the conf as executable
+# Gentoo version just doesn't work properly
pkgname=chrony-openrc
-pkgver=20181030
+pkgver=20181031
pkgrel=2
pkgdesc="OpenRC chronyd init script"
arch=('any')
@@ -19,8 +21,8 @@ conflicts=('ntp' 'ntp-openrc')
backup=('etc/init.d/chronyd')
source=("chronyd.initd"
"chronyd.confd")
-sha256sums=('348076a7e2022b991fbc79012eebb1c0b57acc1ccf770db0da08019d90ae0e18'
- '7997a9453e030d18342937e4aa923eb541b9cee4450660f332aa5ba3eebfaca4')
+sha256sums=('07395f2511f242740555403d8c28ae019dee53cb0eda71a7d78cd05ef703820f'
+ 'da63f49466574cd3d63ffda3176128e62c7de3549dd7f2f5ff33b4662f7dcbb4')
pkgver() {
date +%Y%m%d
@@ -31,7 +33,7 @@ _inst_initd(){
}
_inst_confd(){
- install -Dm755 ${srcdir}/$1.confd ${pkgdir}/etc/conf.d/$1
+ install -Dm644 ${srcdir}/$1.confd ${pkgdir}/etc/conf.d/$1
}
package() {
diff --git a/chronyd.confd b/chronyd.confd
index 37653bc..f4cae7a 100644
--- a/chronyd.confd
+++ b/chronyd.confd
@@ -1,7 +1,5 @@
# /etc/conf.d/chronyd
-CFGFILE="/etc/chrony.conf"
-
# Configuration dependant options :
# -s - Set system time from RTC if rtcfile directive present
# -r - Reload sample histories if dumponexit directive present
@@ -9,4 +7,4 @@ CFGFILE="/etc/chrony.conf"
# The combination of "-s -r" allows chronyd to perform long term averaging of
# the gain or loss rate across system reboots and shutdowns.
-ARGS="-4 -u chrony"
+CHRONY_ARGS="-4 -u chrony -f /etc/chrony.conf"
diff --git a/chronyd.initd b/chronyd.initd
index 8fb654e..0b50a5a 100644
--- a/chronyd.initd
+++ b/chronyd.initd
@@ -2,69 +2,16 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+command="/usr/bin/chronyd"
+command_args="${CHRONY_ARGS}"
+pidfile="/run/${RC_SVCNAME}.pid"
+start_stop_daemon_args="--background --make-pidfile"
+
depend() {
need net
use logger 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
- PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"`
- 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
-
- [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid
-
- ebegin "Starting chronyd"
- start-stop-daemon \
- --start \
- --quiet \
- --exec /usr/bin/chronyd \
- --pidfile "${PIDFILE}" \
- -- -f "${CFGFILE}" ${ARGS}
- eend $? "Failed to start chronyd"
-}
-
-stop() {
- checkconfig || return $?
-
- [ -n "${PIDFILE}" ] || PIDFILE=/run/chronyd.pid
-
- ebegin "Stopping chronyd"
- start-stop-daemon \
- --stop \
- --quiet \
- --pidfile "${PIDFILE}"
- eend $? "Failed to stop chronyd"
+stop_pre() {
+ pkill -u chrony
}