From 2ba73a35c4907336858320b31ce515a6aa10698f Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 21 Dec 2016 08:46:44 -0600 Subject: ntp.drift must be in a directory writable by ntp --- recipes-support/ntp/files/ntp.conf.patch | 12 +++++++----- recipes-support/ntp/ntp_4.2.6p5.bbappend | 12 ++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'recipes-support') diff --git a/recipes-support/ntp/files/ntp.conf.patch b/recipes-support/ntp/files/ntp.conf.patch index 0700553..499dac5 100644 --- a/recipes-support/ntp/files/ntp.conf.patch +++ b/recipes-support/ntp/files/ntp.conf.patch @@ -1,11 +1,13 @@ diff -u old/ntp.conf new/ntp.conf ---- old/ntp.conf 2016-12-20 15:41:04.992738081 -0600 -+++ new/ntp.conf 2016-12-20 16:07:40.632709506 -0600 -@@ -1,7 +1,19 @@ +--- old/ntp.conf 2016-12-21 08:36:33.887646960 -0600 ++++ new/ntp.conf 2016-12-21 08:37:41.115645756 -0600 +@@ -1,7 +1,20 @@ -# This is the most basic ntp configuration file # The driftfile must remain in a place specific to this # machine - it records the machine specific clock error - driftfile /etc/ntp.drift +-driftfile /etc/ntp.drift ++# Driftfile must be in a directory owned by ntp ++driftfile /var/lib/ntp/ntp.drift + +# The following code is for evaluating the timeserver. +# Remove the # to activate the statistics @@ -22,7 +24,7 @@ diff -u old/ntp.conf new/ntp.conf # This should be a server that is close (in IP terms) # to the machine. Add other servers as required. # Unless you un-comment the line below ntpd will sync -@@ -9,8 +21,26 @@ +@@ -9,8 +22,26 @@ # # server time.server.example.com # diff --git a/recipes-support/ntp/ntp_4.2.6p5.bbappend b/recipes-support/ntp/ntp_4.2.6p5.bbappend index 9c6419e..4651611 100644 --- a/recipes-support/ntp/ntp_4.2.6p5.bbappend +++ b/recipes-support/ntp/ntp_4.2.6p5.bbappend @@ -9,14 +9,18 @@ python do_patch_prepend () { import os } pkg_postinst_${PN} () { - touch /etc/ntp.drift - chown ntp:ntp /etc/ntp.drift - chmod 664 /etc/ntp.drift if ! [[ -d /var/log/ntpstats ]] ; then mkdir -p /var/log/ntpstats fi - chown ntp:ntp /var/log/ntpstats chmod 775 /var/log/ntpstats + + if ! [[ -d /var/lib/ntp ]] ; then + mkdir -p /var/lib/ntp + fi + drfile="/var/lib/ntp/ntp.drift" + touch ${drfile} + chown ntp:ntp ${drfile} + chmod 664 ${drfile} } -- cgit v1.2.3