pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/ntp4 This adds rc.d scripts. The ntp.conf is examp...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5421377103f3
branches:  trunk
changeset: 470756:5421377103f3
user:      reed <reed%pkgsrc.org@localhost>
date:      Thu Mar 11 20:39:40 2004 +0000

description:
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:

 net/ntp4/Makefile         |   9 ++++++-
 net/ntp4/files/ntp.conf   |  42 +++++++++++++++++++++++++++++++++++++
 net/ntp4/files/ntpd.sh    |  52 +++++++++++++++++++++++++++++++++++++++++++++++
 net/ntp4/files/ntpdate.sh |  31 ++++++++++++++++++++++++++++
 4 files changed, 132 insertions(+), 2 deletions(-)

diffs (170 lines):

diff -r 72db974771ee -r 5421377103f3 net/ntp4/Makefile
--- a/net/ntp4/Makefile Thu Mar 11 20:29:58 2004 +0000
+++ b/net/ntp4/Makefile Thu Mar 11 20:39:40 2004 +0000
@@ -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 @@
 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 -r 72db974771ee -r 5421377103f3 net/ntp4/files/ntp.conf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/ntp4/files/ntp.conf   Thu Mar 11 20:39:40 2004 +0000
@@ -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 -r 72db974771ee -r 5421377103f3 net/ntp4/files/ntpd.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/ntp4/files/ntpd.sh    Thu Mar 11 20:39:40 2004 +0000
@@ -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 -r 72db974771ee -r 5421377103f3 net/ntp4/files/ntpdate.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/ntp4/files/ntpdate.sh Thu Mar 11 20:39:40 2004 +0000
@@ -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"



Home | Main Index | Thread Index | Old Index