summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support
diff options
context:
space:
mode:
authorPeter A. Bigot <bigotp@acm.org>2012-01-04 02:21:05 +0000
committerKoen Kooi <koen@dominion.thruhere.net>2012-01-05 10:15:55 +0100
commit42d6f4f36696faaf0e526b14bcc6daff51ab943b (patch)
treec05f6e11c9239ec68830cd085db988285e2777ae /meta-oe/recipes-support
parentdc32361d19b49c9cb2df1d73dc61dfe7255a11b2 (diff)
downloadmeta-openembedded-42d6f4f36696faaf0e526b14bcc6daff51ab943b.tar.gz
ntp: correct systemd EnvironmentFile, add ntpdate service
Eliminate EnvironmentFile from systemd unit descriptions. /etc/ntp.conf can't be sourced to set environment variables like NTPD_ARG. Following the rationale at http://0pointer.de/blog/projects/on-etc-sysinit.html it isn't needed anyway; if you don't buy that, it should be: EnvironmentFile=-/etc/default/ntpd Add one-shot ntpdate service which synchronizes local clock prior to starting ntpd (which aborts if the local time is more than 1000 seconds off of the server). "systemctl enable ntpdate.service" not done by default because this would be a behavior change. Correct comment describing how to replace ntpdate (ntpdc doesn't take those arguments). Add comment to ntp.conf pointing out need to remove local hardware clock as a reference when simulating ntpdate. Signed-off-by: Peter A. Bigot <bigotp@acm.org> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-support')
-rw-r--r--meta-oe/recipes-support/ntp/files/ntp.conf1
-rw-r--r--meta-oe/recipes-support/ntp/files/ntpd.service3
-rw-r--r--meta-oe/recipes-support/ntp/files/ntpdate.service11
-rw-r--r--meta-oe/recipes-support/ntp/ntp.inc3
-rw-r--r--meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb4
5 files changed, 18 insertions, 4 deletions
diff --git a/meta-oe/recipes-support/ntp/files/ntp.conf b/meta-oe/recipes-support/ntp/files/ntp.conf
index 596482870..bf52440ce 100644
--- a/meta-oe/recipes-support/ntp/files/ntp.conf
+++ b/meta-oe/recipes-support/ntp/files/ntp.conf
@@ -7,6 +7,7 @@ driftfile /etc/ntp.drift
7# as required, or change this. 7# as required, or change this.
8server pool.ntp.org 8server pool.ntp.org
9# Using local hardware clock as fallback 9# Using local hardware clock as fallback
10# Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself
10server 127.127.1.0 11server 127.127.1.0
11fudge 127.127.1.0 stratum 14 12fudge 127.127.1.0 stratum 14
12# Defining a default security setting 13# Defining a default security setting
diff --git a/meta-oe/recipes-support/ntp/files/ntpd.service b/meta-oe/recipes-support/ntp/files/ntpd.service
index 420a0563a..bd87b1ea2 100644
--- a/meta-oe/recipes-support/ntp/files/ntpd.service
+++ b/meta-oe/recipes-support/ntp/files/ntpd.service
@@ -5,8 +5,7 @@ After=network.target
5[Service] 5[Service]
6Type=forking 6Type=forking
7PIDFile=/run/ntpd.pid 7PIDFile=/run/ntpd.pid
8EnvironmentFile=/etc/ntp.conf 8ExecStart=/usr/bin/ntpd -p /run/ntpd.pid
9ExecStart=/usr/bin/ntpd $NTPD_ARGS -p /run/ntpd.pid
10 9
11[Install] 10[Install]
12WantedBy=multi-user.target 11WantedBy=multi-user.target
diff --git a/meta-oe/recipes-support/ntp/files/ntpdate.service b/meta-oe/recipes-support/ntp/files/ntpdate.service
new file mode 100644
index 000000000..b2bc63206
--- /dev/null
+++ b/meta-oe/recipes-support/ntp/files/ntpdate.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=Network Time Service (one-shot ntpdate mode)
3Before=ntpd.service
4
5[Service]
6Type=oneshot
7ExecStart=/usr/bin/ntpd -q -g -x
8RemainAfterExit=yes
9
10[Install]
11WantedBy=multi-user.target
diff --git a/meta-oe/recipes-support/ntp/ntp.inc b/meta-oe/recipes-support/ntp/ntp.inc
index b398b801e..1d740f00f 100644
--- a/meta-oe/recipes-support/ntp/ntp.inc
+++ b/meta-oe/recipes-support/ntp/ntp.inc
@@ -28,7 +28,8 @@ EXTRA_OECONF = "--without-openssl --without-crypto ac_cv_header_readline_history
28CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" 28CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED"
29 29
30PACKAGES += "ntpdate ${PN}-bin ${PN}-tickadj ${PN}-utils" 30PACKAGES += "ntpdate ${PN}-bin ${PN}-tickadj ${PN}-utils"
31# NOTE: you don't need ntpdate, use "ntpdc -q -g -x" 31# NOTE: you don't need ntpdate, use "ntpd -q -g -x"
32# or the ntpdate systemd service
32 33
33# This should use rc.update 34# This should use rc.update
34FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/init.d/ntpdate" 35FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/init.d/ntpdate"
diff --git a/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb b/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb
index e2bb1a806..063d82a87 100644
--- a/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb
+++ b/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb
@@ -1,6 +1,6 @@
1require ntp.inc 1require ntp.inc
2 2
3PR = "r3" 3PR = "r4"
4 4
5inherit systemd 5inherit systemd
6 6
@@ -13,6 +13,7 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${P}.tar.gz \
13 file://ntpd \ 13 file://ntpd \
14 file://ntp.conf \ 14 file://ntp.conf \
15 file://ntpdate \ 15 file://ntpdate \
16 file://ntpdate.service \
16 file://ntpd.service \ 17 file://ntpd.service \
17" 18"
18 19
@@ -29,6 +30,7 @@ do_install_append() {
29 install -m 755 ${WORKDIR}/ntpdate ${D}/${sysconfdir}/network/if-up.d 30 install -m 755 ${WORKDIR}/ntpdate ${D}/${sysconfdir}/network/if-up.d
30 31
31 install -d ${D}${base_libdir}/systemd/system 32 install -d ${D}${base_libdir}/systemd/system
33 install -m 0644 ${WORKDIR}/ntpdate.service ${D}${base_libdir}/systemd/system/
32 install -m 0644 ${WORKDIR}/ntpd.service ${D}${base_libdir}/systemd/system/ 34 install -m 0644 ${WORKDIR}/ntpd.service ${D}${base_libdir}/systemd/system/
33} 35}
34 36