2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ntpd
|
2005-12-21 09:48:41 +00:00
|
|
|
# REQUIRE: DAEMON ntpdate cleanvar devfs
|
2002-06-13 22:14:37 +00:00
|
|
|
# BEFORE: LOGIN
|
2008-07-16 19:50:29 +00:00
|
|
|
# KEYWORD: nojail shutdown
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
2009-05-30 21:51:38 +00:00
|
|
|
name="ntpd"
|
2002-08-14 05:44:32 +00:00
|
|
|
rcvar=`set_rcvar`
|
|
|
|
command="/usr/sbin/${name}"
|
|
|
|
pidfile="/var/run/${name}.pid"
|
2004-09-14 03:01:38 +00:00
|
|
|
start_precmd="ntpd_precmd"
|
2006-04-18 15:02:24 +00:00
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
|
2002-06-13 22:14:37 +00:00
|
|
|
ntpd_precmd()
|
|
|
|
{
|
2006-04-18 15:02:24 +00:00
|
|
|
rc_flags="-c ${ntpd_config} ${ntpd_flags}"
|
|
|
|
|
2004-09-14 03:01:38 +00:00
|
|
|
if checkyesno ntpd_sync_on_start; then
|
2009-01-29 06:43:29 +00:00
|
|
|
rc_flags="-g $rc_flags"
|
2004-09-14 03:01:38 +00:00
|
|
|
fi
|
|
|
|
|
2002-06-13 22:14:37 +00:00
|
|
|
if [ -z "$ntpd_chrootdir" ]; then
|
|
|
|
return 0;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If running in a chroot cage, ensure that the appropriate files
|
2002-10-12 10:31:31 +00:00
|
|
|
# exist inside the cage, as well as helper symlinks into the cage
|
2002-06-13 22:14:37 +00:00
|
|
|
# from outside.
|
|
|
|
#
|
|
|
|
# As this is called after the is_running and required_dir checks
|
|
|
|
# are made in run_rc_command(), we can safely assume ${ntpd_chrootdir}
|
|
|
|
# exists and ntpd isn't running at this point (unless forcestart
|
|
|
|
# is used).
|
|
|
|
#
|
|
|
|
if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then
|
|
|
|
rm -f "${ntpd_chrootdir}/dev/clockctl"
|
|
|
|
( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
|
|
|
|
fi
|
|
|
|
ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
|
|
|
|
|
|
|
|
# Change run_rc_commands()'s internal copy of $ntpd_flags
|
|
|
|
#
|
|
|
|
rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"
|
|
|
|
}
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
run_rc_command "$1"
|