src_prepare() {
sed -i \
- -e 's:/etc/chrony\.:/etc/chrony/chrony.:g' \
- -e 's:/var/run:/run:g' \
- conf.c doc/*.man.in examples/* || die
+ -e 's:/etc/chrony\.conf:/etc/chrony/chrony.conf:g' \
+ doc/* examples/* || die
default
}
$(usex rtc '' --disable-rtc) \
${CHRONY_EDITLINE} \
${EXTRA_ECONF} \
- --docdir=/usr/share/doc/${PF} \
--chronysockdir=/run/chrony \
+ --disable-sechash \
+ --docdir=/usr/share/doc/${PF} \
--mandir=/usr/share/man \
--prefix=/usr \
--sysconfdir=/etc/chrony \
- --disable-sechash \
+ --with-pidfile="${EPREFIX}/run/chrony/chronyd.pid"
--without-nss \
--without-tomcrypt
"
src_install() {
default
- newinitd "${FILESDIR}"/chronyd.init-r1 chronyd
+ newinitd "${FILESDIR}"/chronyd.init-r2 chronyd
newconfd "${FILESDIR}"/chronyd.conf chronyd
insinto /etc/${PN}
--- /dev/null
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ 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
+ PIDFILE=`awk '/^ *pidfile/{print $2}' "${CFGFILE}"`
+ [ -z "${PIDFILE}" ] && PIDFILE=/run/chrony/chronyd.pid
+ 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/sbin/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"
+}