summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Witt <randy.e.witt@linux.intel.com>2015-03-24 10:26:36 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-25 12:39:45 +0000
commitd2690754febcaff134de2085294af4561c1d9214 (patch)
tree3493115e000b51a7af969792e81aa6cd9896ccd1
parent96104b825f0802166790983f52f8b8929869f553 (diff)
downloadpoky-d2690754febcaff134de2085294af4561c1d9214.tar.gz
image.bbclass: Empty /var/volatile if it is a mount point
If /var/volatile is a mount point it shouldn't contain any files before mount time. If files are there, they will no longer be able to be accessed once the tmpfs gets mounted at /var/volatile. This problem can be seen for instance when systemd creates /var/volatile/log/journal as part of its package installation. It then assumes the journal is persistent even though /var/volatile/log/journal goes away shortly thereafter. This change makes sure that there are no files in /var/volatile if it is to be used as a mount point. [Yocto #7388] (From OE-Core rev: b574ac6f3c9e07f0054ed4261bc1f83583c29c53) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/image.bbclass18
1 files changed, 18 insertions, 0 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index cd1783770b..03cbbf7a91 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -181,6 +181,8 @@ POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
181SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}' 181SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}'
182ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; ", "", d)}' 182ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; ", "", d)}'
183 183
184ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
185
184# some default locales 186# some default locales
185IMAGE_LINGUAS ?= "de-de fr-fr en-gb" 187IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
186 188
@@ -377,6 +379,22 @@ set_systemd_default_target () {
377 fi 379 fi
378} 380}
379 381
382# If /var/volatile is not empty, we have seen problems where programs such as the
383# journal make assumptions based on the contents of /var/volatile. The journal
384# would then write to /var/volatile before it was mounted, thus hiding the
385# items previously written.
386#
387# This change is to attempt to fix those types of issues in a way that doesn't
388# affect users that may not be using /var/volatile.
389empty_var_volatile () {
390 if [ -e ${IMAGE_ROOTFS}/etc/fstab ]; then
391 match=`awk '$1 !~ "#" && $2 ~ /\/var\/volatile/{print $2}' ${IMAGE_ROOTFS}/etc/fstab 2> /dev/null`
392 if [ -n "$match" ]; then
393 find ${IMAGE_ROOTFS}/var/volatile -mindepth 1 -delete
394 fi
395 fi
396}
397
380# Turn any symbolic /sbin/init link into a file 398# Turn any symbolic /sbin/init link into a file
381remove_init_link () { 399remove_init_link () {
382 if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then 400 if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then