Module Name:    src
Committed By:   spz
Date:           Thu Dec 25 23:00:18 UTC 2014

Modified Files:
        src/etc/rc.d: ntpd

Log Message:
new ntpd wants to be able to translate ntp into a port number after chroot,
so give it its own small copy of /etc/services in the chroot


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/etc/rc.d/ntpd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.d/ntpd
diff -u src/etc/rc.d/ntpd:1.14 src/etc/rc.d/ntpd:1.15
--- src/etc/rc.d/ntpd:1.14	Tue Dec  4 16:38:40 2012
+++ src/etc/rc.d/ntpd	Thu Dec 25 23:00:18 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ntpd,v 1.14 2012/12/04 16:38:40 prlw1 Exp $
+# $NetBSD: ntpd,v 1.15 2014/12/25 23:00:18 spz Exp $
 #
 
 # PROVIDE: ntpd
@@ -50,6 +50,21 @@ ntpd_precmd()
 	fi
 	ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
 
+	if [ ! -d "${ntpd_chrootdir}/etc" ]; then
+		mkdir "${ntpd_chrootdir}/etc"
+	fi
+	if [ ! -f "${ntpd_chrootdir}/etc/services" ]; then
+		getent services ntp/udp ntp/tcp \
+			> "${ntpd_chrootdir}/etc/services"
+	fi
+	if [ ! -d "${ntpd_chrootdir}/var/db" ]; then
+		mkdir -p "${ntpd_chrootdir}/var/db"
+	fi
+	if [ ! -f "${ntpd_chrootdir}/var/db/services.cdb" ]; then
+		services_mkdb -o "${ntpd_chrootdir}/var/db/services.cdb" \
+			"${ntpd_chrootdir}/etc/services"
+	fi
+
 	#	Change run_rc_commands()'s internal copy of $ntpd_flags
 	#
 	rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"

Reply via email to