* [PATCH] VOLATILE_TMP_DIR: add
@ 2023-02-27 5:00 Trevor Woerner
2023-02-27 9:23 ` [OE-core] " Alexander Kanavin
0 siblings, 1 reply; 2+ messages in thread
From: Trevor Woerner @ 2023-02-27 5:00 UTC (permalink / raw)
To: openembedded-core
Provide a mechanism to allow users to choose whether the /tmp directory
is on persistent storage (non-volatile) or a RAM-based tmpfs (volatile).
The default is volatile.
Works for both sysvinit-based and systemd-based systems.
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
meta/conf/bitbake.conf | 4 ++++
meta/recipes-core/initscripts/initscripts_1.0.bb | 3 +++
meta/recipes-core/systemd/systemd_252.5.bb | 7 +++++++
3 files changed, 14 insertions(+)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index dcf6ce99d138..afd9e2f5527f 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -90,6 +90,10 @@ ROOT_HOME ??= "/home/root"
# If set to boolean false ('no', 'n', 'false', 'f', '0'), /var/log is on persistent storage.
VOLATILE_LOG_DIR ?= "yes"
+# if set to 'yes': /tmp links to /var/tmp which links to /var/volatile/tmp
+# otherwise: /tmp is on persistent storage
+VOLATILE_TMP_DIR ?= "yes"
+
BB_RENAMED_VARIABLES[PNBLACKLIST] = "SKIP_RECIPE"
BB_RENAMED_VARIABLES[CVE_CHECK_PN_WHITELIST] = "CVE_CHECK_SKIP_RECIPE"
BB_RENAMED_VARIABLES[CVE_CHECK_WHITELIST] = "CVE_CHECK_IGNORE"
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index 7c9d9ca4f107..4dc477bb8d69 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -108,6 +108,9 @@ do_install () {
sed -i -e '\@^d root root 0755 /var/volatile/log none$@ a\l root root 0755 /var/log /var/volatile/log' \
${D}${sysconfdir}/default/volatiles/00_core
fi
+ if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then
+ sed -i -e "/\<tmp\>/d" ${D}${sysconfdir}/default/volatiles/00_core
+ fi
install -m 0755 ${WORKDIR}/dmesg.sh ${D}${sysconfdir}/init.d
install -m 0644 ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
diff --git a/meta/recipes-core/systemd/systemd_252.5.bb b/meta/recipes-core/systemd/systemd_252.5.bb
index ea468da150ce..8b92b2cf425c 100644
--- a/meta/recipes-core/systemd/systemd_252.5.bb
+++ b/meta/recipes-core/systemd/systemd_252.5.bb
@@ -288,6 +288,13 @@ do_install() {
rm -rf ${D}${localstatedir}/log/journal/remote
fi
+ # if the user requests /tmp be on persistent storage (i.e. not volatile)
+ # then don't use a tmpfs for /tmp
+ if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then
+ rm -f ${D}${rootlibdir}/systemd/system/tmp.mount
+ rm -f ${D}${rootlibdir}/systemd/system/local-fs.target.wants/tmp.mount
+ fi
+
install -d ${D}${systemd_system_unitdir}/graphical.target.wants
install -d ${D}${systemd_system_unitdir}/multi-user.target.wants
install -d ${D}${systemd_system_unitdir}/poweroff.target.wants
--
2.36.0.rc2.17.g4027e30c53
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [OE-core] [PATCH] VOLATILE_TMP_DIR: add
2023-02-27 5:00 [PATCH] VOLATILE_TMP_DIR: add Trevor Woerner
@ 2023-02-27 9:23 ` Alexander Kanavin
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Kanavin @ 2023-02-27 9:23 UTC (permalink / raw)
To: Trevor Woerner; +Cc: openembedded-core
Do we need tests for this?
Alex
On Mon, 27 Feb 2023 at 06:00, Trevor Woerner <twoerner@gmail.com> wrote:
>
> Provide a mechanism to allow users to choose whether the /tmp directory
> is on persistent storage (non-volatile) or a RAM-based tmpfs (volatile).
> The default is volatile.
>
> Works for both sysvinit-based and systemd-based systems.
>
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> ---
> meta/conf/bitbake.conf | 4 ++++
> meta/recipes-core/initscripts/initscripts_1.0.bb | 3 +++
> meta/recipes-core/systemd/systemd_252.5.bb | 7 +++++++
> 3 files changed, 14 insertions(+)
>
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index dcf6ce99d138..afd9e2f5527f 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -90,6 +90,10 @@ ROOT_HOME ??= "/home/root"
> # If set to boolean false ('no', 'n', 'false', 'f', '0'), /var/log is on persistent storage.
> VOLATILE_LOG_DIR ?= "yes"
>
> +# if set to 'yes': /tmp links to /var/tmp which links to /var/volatile/tmp
> +# otherwise: /tmp is on persistent storage
> +VOLATILE_TMP_DIR ?= "yes"
> +
> BB_RENAMED_VARIABLES[PNBLACKLIST] = "SKIP_RECIPE"
> BB_RENAMED_VARIABLES[CVE_CHECK_PN_WHITELIST] = "CVE_CHECK_SKIP_RECIPE"
> BB_RENAMED_VARIABLES[CVE_CHECK_WHITELIST] = "CVE_CHECK_IGNORE"
> diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
> index 7c9d9ca4f107..4dc477bb8d69 100644
> --- a/meta/recipes-core/initscripts/initscripts_1.0.bb
> +++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
> @@ -108,6 +108,9 @@ do_install () {
> sed -i -e '\@^d root root 0755 /var/volatile/log none$@ a\l root root 0755 /var/log /var/volatile/log' \
> ${D}${sysconfdir}/default/volatiles/00_core
> fi
> + if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then
> + sed -i -e "/\<tmp\>/d" ${D}${sysconfdir}/default/volatiles/00_core
> + fi
> install -m 0755 ${WORKDIR}/dmesg.sh ${D}${sysconfdir}/init.d
> install -m 0644 ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
>
> diff --git a/meta/recipes-core/systemd/systemd_252.5.bb b/meta/recipes-core/systemd/systemd_252.5.bb
> index ea468da150ce..8b92b2cf425c 100644
> --- a/meta/recipes-core/systemd/systemd_252.5.bb
> +++ b/meta/recipes-core/systemd/systemd_252.5.bb
> @@ -288,6 +288,13 @@ do_install() {
> rm -rf ${D}${localstatedir}/log/journal/remote
> fi
>
> + # if the user requests /tmp be on persistent storage (i.e. not volatile)
> + # then don't use a tmpfs for /tmp
> + if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then
> + rm -f ${D}${rootlibdir}/systemd/system/tmp.mount
> + rm -f ${D}${rootlibdir}/systemd/system/local-fs.target.wants/tmp.mount
> + fi
> +
> install -d ${D}${systemd_system_unitdir}/graphical.target.wants
> install -d ${D}${systemd_system_unitdir}/multi-user.target.wants
> install -d ${D}${systemd_system_unitdir}/poweroff.target.wants
> --
> 2.36.0.rc2.17.g4027e30c53
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#177772): https://lists.openembedded.org/g/openembedded-core/message/177772
> Mute This Topic: https://lists.openembedded.org/mt/97260351/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-27 9:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 5:00 [PATCH] VOLATILE_TMP_DIR: add Trevor Woerner
2023-02-27 9:23 ` [OE-core] " Alexander Kanavin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.