net-misc/ntpsec: improve out-of-box configuration
authorAnthony G. Basile <blueness@gentoo.org>
Sun, 25 Feb 2018 17:18:40 +0000 (12:18 -0500)
committerAnthony G. Basile <blueness@gentoo.org>
Sun, 25 Feb 2018 17:19:01 +0000 (12:19 -0500)
Package-Manager: Portage-2.3.19, Repoman-2.3.6

net-misc/ntpsec/files/ntp.conf [new file with mode: 0644]
net-misc/ntpsec/files/ntpd.confd
net-misc/ntpsec/files/ntpd.rc-r2 [moved from net-misc/ntpsec/files/ntpd.rc-r1 with 94% similarity]
net-misc/ntpsec/ntpsec-1.0.0-r3.ebuild [moved from net-misc/ntpsec/ntpsec-1.0.0-r2.ebuild with 83% similarity]
net-misc/ntpsec/ntpsec-9999.ebuild

diff --git a/net-misc/ntpsec/files/ntp.conf b/net-misc/ntpsec/files/ntp.conf
new file mode 100644 (file)
index 0000000..e8d68d2
--- /dev/null
@@ -0,0 +1,21 @@
+# This is a Gentoo specific configuration file so ntpsec
+# works out of the box as a client.  Upstream configuration
+# can be found in /etc/ntp.d/, but these are not used by
+# this file.  They are provided as a guide to more complex
+# configurations.  For more information on how to configure
+# ntpsec see https://docs.ntpsec.org/latest/
+
+# Pools for Gentoo users
+pool 0.gentoo.pool.ntp.org
+pool 1.gentoo.pool.ntp.org
+pool 2.gentoo.pool.ntp.org
+pool 3.gentoo.pool.ntp.org
+
+# These are the restrictions most people want
+restrict default kod limited nomodify nopeer noquery
+restrict -6 default kod limited nomodify nopeer noquery
+restrict 127.0.0.1
+restrict -6 ::1
+
+# Don't change this location.
+driftfile /var/lib/ntp/ntp.drift
index 92c553a6261582e3808ad1ba451cbd963656258d..50c1aac606655a57a9eeb1fcfc99fe8969eb9870 100644 (file)
@@ -1,7 +1,4 @@
 # /etc/conf.d/ntpd
 
-# Options to pass to the ntpd process
-# Most people should leave this line alone ...
-# however, if you know what you're doing, feel free to tweak
-#NTPD_OPTS="-g -n -u ntp:ntp"
+# Most people should leave this line alone.
 NTPD_OPTS="-g -u ntp:ntp"
similarity index 94%
rename from net-misc/ntpsec/files/ntpd.rc-r1
rename to net-misc/ntpsec/files/ntpd.rc-r2
index dbe76c85e536b9656dfee70507e96fe837e3ae15..13fcbdd092d2773fe1d93051a55113ec69d325fd 100644 (file)
@@ -4,7 +4,7 @@
 # $Id$
 
 description="ntpd - the network time protocol daemon"
-pidfile="/var/run/ntpd.pid"
+pidfile="/run/ntpd.pid"
 command="/usr/sbin/ntpd"
 command_args="-p ${pidfile} ${NTPD_OPTS}"
 start_stop_daemon_args="--pidfile ${pidfile}"
similarity index 83%
rename from net-misc/ntpsec/ntpsec-1.0.0-r2.ebuild
rename to net-misc/ntpsec/ntpsec-1.0.0-r3.ebuild
index 46136f2fa0e357bf902a8a7b35c819107e3c7123..ab3302255ec7e0920073ff384563764827bf5efc 100644 (file)
@@ -118,21 +118,25 @@ src_install() {
        python_foreach_impl run_in_build_dir python_install
 
        # Install heat generating scripts
-       use heat && dosbin "${S}/contrib/ntpheat"{,usb}
+       use heat && dosbin "${S}"/contrib/ntpheat{,usb}
 
        # Install the openrc files
-       newinitd "${FILESDIR}/ntpd.rc-r1" "ntp"
-       newconfd "${FILESDIR}/ntpd.confd" "ntp"
+       newinitd "${FILESDIR}"/ntpd.rc-r2 ntp
+       newconfd "${FILESDIR}"/ntpd.confd ntp
 
        # Install the systemd unit file
-       systemd_newunit "${FILESDIR}/ntpd.service" ntpd.service
+       systemd_newunit "${FILESDIR}"/ntpd.service ntpd.service
+
+       # Prepare a directory for the ntp.drift file
+       mkdir -pv "${ED}"/var/lib/ntp
+       chown ntp:ntp "${ED}"/var/lib/ntp
+       chmod 770 "${ED}"/var/lib/ntp
 
        # Install a log rotate script
-       mkdir -pv "${ED}/etc/"logrotate.d
-       cp -v "${S}/etc/logrotate-config.ntpd" "${ED}/etc/logrotate.d/ntpd"
+       mkdir -pv "${ED}"/etc/logrotate.d
+       cp -v "${S}"/etc/logrotate-config.ntpd "${ED}"/etc/logrotate.d/ntpd
 
-       # Install the configuration files
-       cp -Rv "${S}/etc/ntp.d/" "${ED}/etc/"
-       mv -v "${ED}/etc/ntp.d/default.conf" "${ED}/etc/ntp.conf"
-       sed "s|includefile |includefile ntp.d/|" -i "${ED}/etc/ntp.conf"
+       # Install the configuration file and sample configuration
+       cp -v "${FILESDIR}"/ntp.conf "${ED}"/etc/ntp.conf
+       cp -Rv "${S}"/etc/ntp.d/ "${ED}"/etc/
 }
index 8263e59187fda672f9ab045eea587d48fada10ad..a565abf1c84d47d49bc46ef63ac9c6c5274bd4a2 100644 (file)
@@ -117,21 +117,25 @@ src_install() {
        python_foreach_impl run_in_build_dir python_install
 
        # Install heat generating scripts
-       use heat && dosbin "${S}/contrib/ntpheat"{,usb}
+       use heat && dosbin "${S}"/contrib/ntpheat{,usb}
 
        # Install the openrc files
-       newinitd "${FILESDIR}/ntpd.rc-r1" "ntp"
-       newconfd "${FILESDIR}/ntpd.confd" "ntp"
+       newinitd "${FILESDIR}"/ntpd.rc-r2 ntp
+       newconfd "${FILESDIR}"/ntpd.confd ntp
 
        # Install the systemd unit file
-       systemd_newunit "${FILESDIR}/ntpd.service" ntpd.service
+       systemd_newunit "${FILESDIR}"/ntpd.service ntpd.service
+
+       # Prepare a directory for the ntp.drift file
+       mkdir -pv "${ED}"/var/lib/ntp
+       chown ntp:ntp "${ED}"/var/lib/ntp
+       chmod 770 "${ED}"/var/lib/ntp
 
        # Install a log rotate script
-       mkdir -pv "${ED}/etc/"logrotate.d
-       cp -v "${S}/etc/logrotate-config.ntpd" "${ED}/etc/logrotate.d/ntpd"
+       mkdir -pv "${ED}"/etc/logrotate.d
+       cp -v "${S}"/etc/logrotate-config.ntpd "${ED}"/etc/logrotate.d/ntpd
 
-       # Install the configuration files
-       cp -Rv "${S}/etc/ntp.d/" "${ED}/etc/"
-       mv -v "${ED}/etc/ntp.d/default.conf" "${ED}/etc/ntp.conf"
-       sed "s|includefile |includefile ntp.d/|" -i "${ED}/etc/ntp.conf"
+       # Install the configuration file and sample configuration
+       cp -v "${FILESDIR}"/ntp.conf "${ED}"/etc/ntp.conf
+       cp -Rv "${S}"/etc/ntp.d/ "${ED}"/etc/
 }