From c386e5ab799ef1812a1b787b30c229fbded7db61 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Tue, 2 Nov 2021 19:51:41 +0100 Subject: openflow: Create /var/log/openflow in runtime /var/log is normally a link to /var/volatile/log and /var/volatile is a tmpfs mount. So anything created in /var/log will not be available when the tmpfs is mounted. Signed-off-by: Peter Kjellerstedt Signed-off-by: Khem Raj --- .../recipes-protocols/openflow/openflow.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/meta-networking/recipes-protocols/openflow/openflow.inc b/meta-networking/recipes-protocols/openflow/openflow.inc index 94d9553e11..c4e69b58e3 100644 --- a/meta-networking/recipes-protocols/openflow/openflow.inc +++ b/meta-networking/recipes-protocols/openflow/openflow.inc @@ -34,4 +34,22 @@ do_configure:prepend() { do_install:append() { # Remove /var/run as it is created on startup rm -rf ${D}${localstatedir}/run + + # /var/log/openflow needs to be created in runtime. Use rmdir to catch if + # upstream stops creating /var/log/openflow, or adds something else in + # /var/log. + rmdir ${D}${localstatedir}/log/${BPN} ${D}${localstatedir}/log + rmdir --ignore-fail-on-non-empty ${D}${localstatedir} + + # Create /var/log/openflow in runtime. + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then + install -d ${D}${nonarch_libdir}/tmpfiles.d + echo "d ${localstatedir}/log/${BPN} - - - -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf + fi + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then + install -d ${D}${sysconfdir}/default/volatiles + echo "d root root 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN} + fi } + +FILES:${PN} += "${nonarch_libdir}/tmpfiles.d" -- cgit v1.2.3-54-g00ecf