vp-build/templates/ntp/files/ntpd.rc
Juan RP b1f0282c6a ntp: switch to OpenRC. Create ntpd user/group for chroot.
--HG--
extra : convert_revision : 5ecbdd2f519c0605978a7a2e3e503dae5bb7e99f
2009-05-10 17:52:04 +02:00

38 lines
840 B
Plaintext

#!/sbin/runscript
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
: ${ntpd_config:=/etc/ntp.conf}
: ${ntpd_drift:=/var/db/ntpd.drift}
command=/usr/bin/ntpd
required_files=$ntpd_config
pidfile=/var/run/ntpd.pid
command_args="$ntpd_args -c $ntpd_config -f $ntpd_drift -p $pidfile"
name="Network Time Protocol Daemon"
depend()
{
use dns
need localmount
after bootmisc ntp-client
}
start_pre()
{
if [ -n "$ntpd_chroot" ]; then
case "$RC_UNAME" in
*BSD|DragonFly)
if [ ! -c "$ntpd_chroot/dev/clockctl" ]; then
rm -f "$ntpd_chroot/dev/clockctl"
(cd /dev; /bin/pax -rw -pe clockctl \
"$ntpd_chroot/dev")
fi
;;
esac
ln -fs "$ntpd_chroot$ntpd_drift" "$ntpd_drift"
command_args="$command_args -u ntpd:ntpd -i $ntpd_chroot"
fi
}