ntp: create and package ntp home directory
authorPeter Bigot <pab@pabigot.com>
Sun, 12 Oct 2014 21:23:49 +0000 (16:23 -0500)
committerPatrick Ohly <patrick.ohly@intel.com>
Fri, 9 Jan 2015 16:42:53 +0000 (08:42 -0800)
This allows the base recipe and bbappends to reference persistent
mutable state such as a drift file.

(From meta-openembedded rev: 657b3642c43192d94fcdcbc7bf11fafa111fa83c)

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
meta-openembedded/meta-networking/recipes-support/ntp/ntp.inc

index f55a39a..fd29a78 100644 (file)
@@ -36,7 +36,9 @@ EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readl
 CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED"
 
 USERADD_PACKAGES = "${PN}"
-USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ntp \
+NTP_USER_HOME ?= "/var/lib/ntp"
+USERADD_PARAM_${PN} = "--system --home-dir ${NTP_USER_HOME} \
+                       --no-create-home \
                        --shell /bin/false --user-group ntp"
 
 # NB: debug is default-enabled by NTP; keep it default-enabled here.
@@ -57,6 +59,9 @@ do_install_append() {
     install -d ${D}${bindir}
     install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync
 
+    install -m 755 -d ${D}${NTP_USER_HOME}
+    chown ntp:ntp ${D}${NTP_USER_HOME}
+
     # Fix hardcoded paths in scripts
     sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
     sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync
@@ -111,6 +116,7 @@ RCONFLICTS_ntpdate += "ntpdate-systemd"
 RSUGGESTS_${PN} = "iana-etc"
 
 FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir} \
+    ${NTP_USER_HOME} \
     ${systemd_unitdir}/ntp-units.d/60-ntpd.list \
 "
 FILES_${PN}-tickadj = "${sbindir}/tickadj"