ntpd revision 1.4
11.1Ssimonb#!/bin/sh
21.1Ssimonb#
31.4Slukem# $NetBSD: ntpd,v 1.4 2002/01/18 10:51:30 lukem Exp $
41.1Ssimonb#
51.1Ssimonb
61.1Ssimonb# PROVIDE: ntpd
71.1Ssimonb# REQUIRE: DAEMON
81.1Ssimonb
91.1Ssimonb. /etc/rc.subr
101.1Ssimonb
111.1Ssimonbname="ntpd"
121.3Slukemrcvar=$name
131.1Ssimonbcommand="/usr/sbin/${name}"
141.1Ssimonbpidfile="/var/run/${name}.pid"
151.4Slukemstart_precmd="ntpd_precmd"
161.1Ssimonbrequired_files="/etc/ntp.conf"
171.4Slukem
181.4Slukemntpd_precmd()
191.4Slukem{
201.4Slukem	if [ -z "$ntpd_chrootdir" ]; then
211.4Slukem		return 0;
221.4Slukem	fi
231.4Slukem
241.4Slukem	# If running in a chroot cage, ensure that the appropriate files
251.4Slukem	# exist inside the cage, as well as helper symlinks into the cage 
261.4Slukem	# from outside.
271.4Slukem	#
281.4Slukem	# As this is called after the is_running and required_dir checks
291.4Slukem	# are made in run_rc_command(), we can safely assume ${ntpd_chrootdir}
301.4Slukem	# exists and ntpd isn't running at this point (unless forcestart
311.4Slukem	# is used).
321.4Slukem	#
331.4Slukem	if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then
341.4Slukem		rm -f "${ntpd_chrootdir}/dev/clockctl"
351.4Slukem		( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
361.4Slukem	fi
371.4Slukem	ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
381.4Slukem
391.4Slukem	#	Change run_rc_commands()'s internal copy of $ntpd_flags
401.4Slukem	#
411.4Slukem	_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $_flags"
421.4Slukem}
431.1Ssimonb
441.2Slukemload_rc_config $name
451.1Ssimonbrun_rc_command "$1"
46