summaryrefslogtreecommitdiff
path: root/net/ntp4
diff options
context:
space:
mode:
authorreed <reed@pkgsrc.org>2004-03-11 20:39:40 +0000
committerreed <reed@pkgsrc.org>2004-03-11 20:39:40 +0000
commit62dede65651982097b284cb1af720e92b3592c3c (patch)
tree05aec0900abae8afae04479696324f4ab9d95729 /net/ntp4
parent3f10520a8101fb1edf95431e1112ebb397827fc1 (diff)
downloadpkgsrc-62dede65651982097b284cb1af720e92b3592c3c.tar.gz
This adds rc.d scripts. The ntp.conf is example from official NetBSD.
The rc.d scripts are based on official NetBSD scripts. This also adds: CONFIGURE_ARGS+=--sysconfdir=${PKG_SYSCONFDIR} This was discussed and okayed with maintainer, fredb, in February, Currently, the ntpd.sh rc.d script has a note about the ntpd_chrootdir is only for NetBSD at this time. (Because I haven't tested under other operating systems.)
Diffstat (limited to 'net/ntp4')
-rw-r--r--net/ntp4/Makefile9
-rw-r--r--net/ntp4/files/ntp.conf42
-rwxr-xr-xnet/ntp4/files/ntpd.sh52
-rwxr-xr-xnet/ntp4/files/ntpdate.sh31
4 files changed, 132 insertions, 2 deletions
diff --git a/net/ntp4/Makefile b/net/ntp4/Makefile
index 7343957035b..6cbcdf193b0 100644
--- a/net/ntp4/Makefile
+++ b/net/ntp4/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.31 2004/02/03 23:04:41 reed Exp $
+# $NetBSD: Makefile,v 1.32 2004/03/11 20:39:40 reed Exp $
#
DISTNAME= ntp-4.2.0
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= net
MASTER_SITES= ftp://ftp.udel.edu/pub/ntp/ntp4/ \
http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/
@@ -14,13 +14,18 @@ COMMENT= Network Time Protocol Version 4
GNU_CONFIGURE= YES
USE_PERL5= build
#USE_BUILDLINK2=YES ***FIXME: Causes lots of "missing prototype" warnings.***
+USE_PKGINSTALL= YES
CONFIGURE_ENV+= PATH_PERL="${PERL5}" ac_cv_header_sys_soundcard_h=no
+CONFIGURE_ARGS+=--sysconfdir=${PKG_SYSCONFDIR}
+
DOCDIR= ${PREFIX}/share/doc/html
EXAMPLESDIR= ${PREFIX}/share/examples
ALL_NTP_DOCS= ${DOCDIR}/ntp4 ${EXAMPLESDIR}/ntp4
+RCD_SCRIPTS= ntpd ntpdate
+
post-install:
(cd ${WRKSRC} && \
${PAX} -rw -pe -s "/html/ntp4/" html ${DOCDIR}; \
diff --git a/net/ntp4/files/ntp.conf b/net/ntp4/files/ntp.conf
new file mode 100644
index 00000000000..f2d081603fe
--- /dev/null
+++ b/net/ntp4/files/ntp.conf
@@ -0,0 +1,42 @@
+# $NetBSD: ntp.conf,v 1.1 2004/03/11 20:39:40 reed Exp $
+#
+# NetBSD default Network Time Protocol (NTP) configuration file
+# for ntpd
+
+# Process ID file, so that the daemon can be signalled from scripts
+
+pidfile /var/run/ntpd.pid
+
+# The correction calculated by ntpd(8) for the local system clock's
+# drift is stored here
+
+driftfile /var/db/ntp.drift
+
+# suppress the syslog(3) message for each peer synchronization change
+
+logconfig -syncstatus
+
+# Hereafter should be "server" or "peer" statements to configure
+# other hosts to exchange NTP packets with. Peers should be selected
+# in such a way that the network path to them is symmetric (that is,
+# the series of links and routers used to get to the peer is the same
+# one that the peer uses to get back. NTP assumes such symmetry
+# in its network delay calculation. NTP will apply an incorrect
+# adjustment to timestamps received from the peer if the path is not
+# symmetric. This can result in clock skew (your system clock being
+# maintained consistently wrong by a certain amount).
+#
+# The best way to select symmetric peers is to make sure that the
+# network path to them is as short as possible (this reduces the
+# chance that there is more than one network path between you and
+# your peer). You can measure these distances with the traceroute(8)
+# program. The best place to start looking for NTP peers for your
+# system is within your own network, or at your Internet Service
+# Provider (ISP).
+#
+# Ideally, you should select at least three other systems to talk
+# NTP with, for an "what I tell you three times is true" effect.
+#
+
+#peer an.ntp.peer.goes.here
+#server an.ntp.server.goes.here
diff --git a/net/ntp4/files/ntpd.sh b/net/ntp4/files/ntpd.sh
new file mode 100755
index 00000000000..e256896d99d
--- /dev/null
+++ b/net/ntp4/files/ntpd.sh
@@ -0,0 +1,52 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: ntpd.sh,v 1.1 2004/03/11 20:39:40 reed Exp $
+#
+
+# PROVIDE: ntpd
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: chrootdir
+
+. /etc/rc.subr
+
+name="ntpd"
+rcvar=$name
+command="@PREFIX@/${name}"
+pidfile="/var/run/${name}.pid"
+start_precmd="ntpd_precmd"
+required_files="@PKG_SYSCONFDIR@/ntp.conf"
+
+ntpd_precmd()
+{
+ if [ -z "$ntpd_chrootdir" ]; then
+ return 0;
+ fi
+
+ # If running in a chroot cage, ensure that the appropriate files
+ # exist inside the cage, as well as helper symlinks into the cage
+ # 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).
+ #
+ # Before enabling ntpd_chrootdir, ensure that:
+ # - The kernel has "pseudo-device clockctl" compiled in
+ # - /dev/clockctl is present
+ # - This is only for NetBSD at this time.
+ #
+ 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"
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/net/ntp4/files/ntpdate.sh b/net/ntp4/files/ntpdate.sh
new file mode 100755
index 00000000000..3c5898b6acc
--- /dev/null
+++ b/net/ntp4/files/ntpdate.sh
@@ -0,0 +1,31 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: ntpdate.sh,v 1.1 2004/03/11 20:39:40 reed Exp $
+#
+
+# PROVIDE: ntpdate
+# REQUIRE: NETWORKING syslogd
+
+. /etc/rc.subr
+
+name="ntpdate"
+rcvar=$name
+start_cmd="ntpdate_start"
+stop_cmd=":"
+
+ntpdate_start()
+{
+ if [ -z "$ntpdate_hosts" ]; then
+ ntpdate_hosts=`awk '
+ /^server[ \t]*127.127/ {next}
+ /^(server|peer)/ {print $2}
+ ' <@PKG_SYSCONFDIR@/ntp.conf`
+ fi
+ if [ -n "$ntpdate_hosts" ]; then
+ echo "Setting date via ntp."
+ @PREFIX@/bin/ntpdate $rc_flags $ntpdate_hosts
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"