mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-25 11:44:44 +00:00
chronyd: don't start it when running on Hyper-V
This is a bit ugly as we copied and then modified the chronyd init.d script as shipped in the package. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
5d0dfdf4fa
commit
32c999a02f
@ -54,6 +54,7 @@ COPY packages/hvtools/etc /etc/
|
|||||||
COPY packages/hvtools/hv_get_dhcp_info /sbin/
|
COPY packages/hvtools/hv_get_dhcp_info /sbin/
|
||||||
COPY packages/hvtools/hv_get_dns_info /sbin/
|
COPY packages/hvtools/hv_get_dns_info /sbin/
|
||||||
COPY packages/hvtools/hv_set_ifconfig /sbin/
|
COPY packages/hvtools/hv_set_ifconfig /sbin/
|
||||||
|
COPY packages/chronyd/etc /etc/
|
||||||
COPY packages/userns/etc /etc/
|
COPY packages/userns/etc /etc/
|
||||||
COPY packages/userns/groupadd /usr/sbin
|
COPY packages/userns/groupadd /usr/sbin
|
||||||
COPY packages/userns/useradd /usr/sbin
|
COPY packages/userns/useradd /usr/sbin
|
||||||
|
73
alpine/packages/chronyd/etc/init.d/chronyd
Executable file
73
alpine/packages/chronyd/etc/init.d/chronyd
Executable file
@ -0,0 +1,73 @@
|
|||||||
|
#!/sbin/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 $
|
||||||
|
|
||||||
|
description="NTP daemon"
|
||||||
|
|
||||||
|
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
|
||||||
|
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() {
|
||||||
|
[ -d /sys/bus/vmbus ] && exit 0
|
||||||
|
checkconfig || return $?
|
||||||
|
setxtrarg
|
||||||
|
|
||||||
|
[ -n "${PIDFILE}" ] || PIDFILE=/var/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() {
|
||||||
|
[ -d /sys/bus/vmbus ] && exit 0
|
||||||
|
checkconfig || return $?
|
||||||
|
|
||||||
|
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/chronyd.pid
|
||||||
|
|
||||||
|
ebegin "Stopping chronyd"
|
||||||
|
start-stop-daemon --stop --quiet \
|
||||||
|
--pidfile "${PIDFILE}"
|
||||||
|
eend $? "Failed to stop chronyd"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user