Skip to contentSkip to conversation

support persistent /var/tmp

PATCH In review Changqing Li 2 participants 8 messages May 13, 2020 – May 14, 2020

lore
Share & tools
lore
#0 lore raw

cover support persistent /var/tmp

From: Changqing Li <[email protected]>

Changqing Li (6):
bitbake.conf: rename VOLATILE_LOG_DIR to VOLATILE_DIR fs-perms-persistent.txt: renamed from fs-perms-persistent-log.txt
base-files: respect VOLATILE_DIR
initscripts: respect VOLATILE_DIR
systemd: respect VOLATILE_DIR
eudev: respect VOLATILE_DIR

 meta/conf/bitbake.conf                                 | 10 ++++++----
 ...erms-persistent-log.txt => fs-perms-persistent.txt} |  2 --
 meta/recipes-core/base-files/base-files_3.0.14.bb      |  7 ++++---
 .../recipes-core/initscripts/initscripts-1.0/volatiles |  3 ---
 meta/recipes-core/initscripts/initscripts_1.0.bb       |  8 +++++++-
 meta/recipes-core/systemd/systemd_245.5.bb             |  4 +++-
 meta/recipes-core/udev/eudev_3.2.9.bb                  |  3 +++
 7 files changed, 23 insertions(+), 14 deletions(-)
 rename meta/files/{fs-perms-persistent-log.txt => fs-perms-persistent.txt} (95%)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/6 bitbake.conf: rename VOLATILE_LOG_DIR to VOLATILE_DIR

From: Changqing Li <[email protected]>

To support persistent /var/tmp, rename VOLATILE_LOG_DIR to VOLATILE_DIR

Don't use VOLATILE_LOG_DIR/VOLATILE_TMP_DIR
to control it separately since it will make things complicated, we need to make kinds of fs-perms*.txt for kinds of combination of the two variables.

---
 meta/conf/bitbake.conf | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
meta/conf/bitbake.conf +6 -4
index bdade79abe..8fd688c793 100644
@@ -86,9 +86,11 @@ USRBINPATH_class-nativesdk = "/usr/bin"
 # Root home directory
 ROOT_HOME ??= "/home/root"
 
-# If set to boolean true ('yes', 'y', 'true', 't', '1'), /var/log links to /var/volatile/log.
-# If set to boolean false ('no', 'n', 'false', 'f', '0'), /var/log is on persistent storage.
-VOLATILE_LOG_DIR ?= "yes"
+# If set to boolean true ('yes', 'y', 'true', 't', '1'), /var/log links to
+# /var/volatile/log, /var/tmp links to /var/volatile/tmp
+# If set to boolean false ('no', 'n', 'false', 'f', '0'), /var/log and /var/tmp
+# is on persistent storage.
+VOLATILE_DIR ?= "yes"
 
 ##################################################################
 # Architecture-dependent build variables.
@@ -350,7 +352,7 @@ FILESEXTRAPATHS ?= "__default:"
 #  datadir, sysconfdir, servicedir, sharedstatedir, localstatedir, infodir,
 #  mandir, docdir, bindir, sbindir, libexecdir, libdir, includedir and
 #  oldincludedir
-FILESYSTEM_PERMS_TABLES ?= "${@'files/fs-perms.txt' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'files/fs-perms-persistent-log.txt'}"
+FILESYSTEM_PERMS_TABLES ?= "${@'files/fs-perms.txt' if oe.types.boolean(d.getVar('VOLATILE_DIR')) else 'files/fs-perms-persistent.txt'}"
 
 ##################################################################
 # General work and output directories for the build system.
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/6 fs-perms-persistent.txt: renamed from fs-perms-persistent-log.txt

In reply to Changqing Li

From: Changqing Li <[email protected]>

since we use one variable VOLATILE_DIR to control the volatile, rename the filename to make it common

---
 .../{fs-perms-persistent-log.txt => fs-perms-persistent.txt}    | 2 --
 1 file changed, 2 deletions(-)
 rename meta/files/{fs-perms-persistent-log.txt => fs-perms-persistent.txt} (95%)
meta/files/fs-perms-persistent.txt renamed from meta/files/fs-perms-persistent-log.txt +0 -2
similarity index 95%
rename from meta/files/fs-perms-persistent-log.txt
rename to meta/files/fs-perms-persistent.txt
index 3a7cf3ab94..9ca9571e6e 100644
@@ -47,7 +47,6 @@ ${oldincludedir}	0755	root	root	true	0644	root	root
 # Links
 ${localstatedir}/run	link	/run
 ${localstatedir}/lock	link	/run/lock
-${localstatedir}/tmp	link	volatile/tmp
 
 /home				0755	root	root	false - - -
 /srv				0755	root	root	false - - -
@@ -57,7 +56,6 @@ ${localstatedir}/local		0755	root	root	false - - -
 # Special permissions from base-files
 # Set 1777
 /tmp				01777	root	root	false - - -
-${localstatedir}/volatile/tmp	01777	root	root	false - - -
 
 # Set 0700
 ${ROOT_HOME}			0700	root	root	false - - -
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/6 base-files: respect VOLATILE_DIR

In reply to Changqing Li

From: Changqing Li <[email protected]>

respect VOLATILE_DIR to support persistent /var/tmp too

---
 meta/recipes-core/base-files/base-files_3.0.14.bb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +4 -3
index 94299431f6..0e06629bbd 100644
@@ -29,7 +29,7 @@ S = "${WORKDIR}"
 INHIBIT_DEFAULT_DEPS = "1"
 
 docdir_append = "/${P}"
-dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
+dirs1777 = "/tmp ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_DIR}') else ''}tmp"
 dirs2775 = ""
 dirs555 = "/sys /proc"
 dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
@@ -42,7 +42,7 @@ dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
            ${localstatedir}/backups ${localstatedir}/lib \
            ${localstatedir}/lib/misc ${localstatedir}/spool \
            ${localstatedir}/volatile \
-           ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''}log \
+           ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_DIR}') else ''}log \
            /home ${prefix}/src ${localstatedir}/local \
            /media"
 
@@ -53,7 +53,8 @@ dirs755-lsb = "/srv  \
                ${prefix}/lib/locale"
 dirs2775-lsb = "/var/mail"
 
-volatiles = "${@'log' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''} tmp"
+volatiles = "${@'log' if oe.types.boolean('${VOLATILE_DIR}') else ''} \
+             ${@'tmp' if oe.types.boolean('${VOLATILE_DIR}') else ''}"
 conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
              ${sysconfdir}/issue /${sysconfdir}/issue.net \
              ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/6 initscripts: respect VOLATILE_DIR

In reply to Changqing Li

From: Changqing Li <[email protected]>

respect VOLATILE_DIR to support persistent /var/tmp too

---
 meta/recipes-core/initscripts/initscripts-1.0/volatiles | 3 ---
 meta/recipes-core/initscripts/initscripts_1.0.bb        | 8 +++++++-
 2 files changed, 7 insertions(+), 4 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/volatiles +0 -3
index cd8a4be05f..eeeb8905da 100644
@@ -24,11 +24,8 @@
 # a link will be created at /var/test pointing to /tmp/testfile and due to this
 # link the file defined as /var/test will actually be created as /tmp/testfile.
 d root root 1777 /run/lock none
-d root root 0755 /var/volatile/log none
-d root root 1777 /var/volatile/tmp none
 l root root 1777 /var/lock /run/lock
 l root root 0755 /var/run /run
-l root root 1777 /var/tmp /var/volatile/tmp
 l root root 1777 /tmp /var/tmp
 d root root 0755 /var/lock/subsys none
 f root root 0664 /var/log/wtmp none
meta/recipes-core/initscripts/initscripts_1.0.bb +7 -1
index 1a59b82fbf..ba6dc068c9 100644
@@ -104,8 +104,14 @@ do_install () {
 	install -m 0755    ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
 	install -m 0755    ${WORKDIR}/save-rtc.sh	${D}${sysconfdir}/init.d
 	install -m 0644    ${WORKDIR}/volatiles		${D}${sysconfdir}/default/volatiles/00_core
-	if [ ${@ oe.types.boolean('${VOLATILE_LOG_DIR}') } = True ]; then
+	if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = True ]; then
+		echo "d root root 0755 /var/volatile/log none" >> ${D}${sysconfdir}/default/volatiles/00_core
+		echo "d root root 1777 /var/volatile/tmp none" >> ${D}${sysconfdir}/default/volatiles/00_core
 		echo "l root root 0755 /var/log /var/volatile/log" >> ${D}${sysconfdir}/default/volatiles/00_core
+		echo "l root root 0755 /var/tmp /var/volatile/tmp" >> ${D}${sysconfdir}/default/volatiles/00_core
+	else
+		sed -i -e 's;TMPROOT="${ROOT_DIR}/var/volatile/tmp";TMPROOT="${ROOT_DIR}/var/tmp";g' \
+                    ${D}${sysconfdir}/init.d/populate-volatile.sh
 	fi
 	install -m 0755    ${WORKDIR}/dmesg.sh		${D}${sysconfdir}/init.d
 	install -m 0644    ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/6 systemd: respect VOLATILE_DIR

In reply to Changqing Li

From: Changqing Li <[email protected]>

respect VOLATILE_DIR to support persistent /var/tmp too

---
 meta/recipes-core/systemd/systemd_245.5.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/systemd/systemd_245.5.bb +3 -1
index ece4220987..a2aed13f4a 100644
@@ -230,7 +230,9 @@ do_install() {
 	install -d ${D}${sysconfdir}/tmpfiles.d
 	install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
 
-	install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
+	if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = True ]; then
+		install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
+	fi
 
 	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
 		install -d ${D}${sysconfdir}/init.d
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/6 eudev: respect VOLATILE_DIR

In reply to Changqing Li

From: Changqing Li <[email protected]>

respect VOLATILE_DIR to support persistent /var/tmp too

---
 meta/recipes-core/udev/eudev_3.2.9.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-core/udev/eudev_3.2.9.bb +3 -0
index f96f8cbe78..fc9a73cf8f 100644
@@ -41,6 +41,9 @@ do_install_append() {
 	install -d ${D}${sysconfdir}/init.d
 	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
 	sed -i s%@UDEVD@%${base_sbindir}/udevd% ${D}${sysconfdir}/init.d/udev
+        if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = False ]; then
+            sed -i -e 's%mkdir -m 1777 -p /var/volatile/tmp%mkdir -m 1777 -p /var/tmp%g' ${D}${sysconfdir}/init.d/udev
+        fi
 
 	install -d ${D}${sysconfdir}/udev/rules.d
 	install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
Signature · 1 line
2.17.1
#7 lore raw
In reply to Changqing Li
Quoted 9 lines · Changqing Li

From: Changqing Li <[email protected]>

Changqing Li (6):
bitbake.conf: rename VOLATILE_LOG_DIR to VOLATILE_DIR fs-perms-persistent.txt: renamed from fs-perms-persistent-log.txt
base-files: respect VOLATILE_DIR
initscripts: respect VOLATILE_DIR
systemd: respect VOLATILE_DIR
eudev: respect VOLATILE_DIR

This patch series doesn't explain what the problem is that its trying to solve.

It also doesn't appear to be bisectable, you have to apply all the patches or none. That implies some of the patches would need to be merged together.

Please can you rework it with an explanation of what the problem is that its trying to solve.

Cheers,

Richard