diff mbox series

[2/5] base-files: update dirs1777 and volatiles according to VOLATILE_TMP_DIR

Message ID 20231208101253.4042712-4-changqing.li@windriver.com
State New
Headers show
Series *** Fix persistent tmp *** | expand

Commit Message

Changqing Li Dec. 8, 2023, 10:12 a.m. UTC
From: Changqing Li <changqing.li@windriver.com>

* update dirs1777 so that only create /var/volatiles/tmp when
VOLATILE_TMP_DIR set to yes, create /var/tmp when VOLATILE_TMP_DIR set
to no

* update volatiles so that only symlink /var/tmp to /var/volatiles/tmp
when VOLATILE_TMP_DIR set to yes

* mount /tmp as tmpfs fs when VOLATILE_TMP_DIR set to no and init
manager is sysvinit

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 meta/recipes-core/base-files/base-files_3.0.14.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Peter Kjellerstedt Dec. 8, 2023, 11:35 p.m. UTC | #1
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Changqing Li
> Sent: den 8 december 2023 11:13
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 2/5] base-files: update dirs1777 and volatiles according to VOLATILE_TMP_DIR
> 
> From: Changqing Li <changqing.li@windriver.com>
> 
> * update dirs1777 so that only create /var/volatiles/tmp when
> VOLATILE_TMP_DIR set to yes, create /var/tmp when VOLATILE_TMP_DIR set
> to no
> 
> * update volatiles so that only symlink /var/tmp to /var/volatiles/tmp
> when VOLATILE_TMP_DIR set to yes
> 
> * mount /tmp as tmpfs fs when VOLATILE_TMP_DIR set to no and init
> manager is sysvinit
> 
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  meta/recipes-core/base-files/base-files_3.0.14.bb | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
> index 9fab53ce63..01d076369d 100644
> --- a/meta/recipes-core/base-files/base-files_3.0.14.bb
> +++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
> @@ -30,7 +30,7 @@ S = "${WORKDIR}"
>  INHIBIT_DEFAULT_DEPS = "1"
> 
>  docdir:append = "/${P}"
> -dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
> +dirs1777 = "/tmp ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_TMP_DIR}') else ''}tmp"
>  dirs2775 = ""
>  dirs555 = "/sys /proc"
>  dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
> @@ -54,7 +54,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_LOG_DIR}') else ''} \
> +             ${@'tmp' if oe.types.boolean('${VOLATILE_TMP_DIR}') else ''}"
>  conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
>               ${sysconfdir}/issue /${sysconfdir}/issue.net \
>               ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
> @@ -122,6 +123,9 @@ do_install () {
>  	fi
> 
>  	install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
> +    if [ ${@ oe.types.boolean('${VOLATILE_TMP_DIR}') } = False ] && ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'false', 'true', d)} ;then
> +        echo "tmpfs   /tmp  tmpfs mode=1777,strictatime,nosuid,nodev,size=50%,nr_inodes=1m   0  0" >> ${D}${sysconfdir}/fstab
> +    fi

Inconsistent indentation. Please use tabs to indent shell code in 
recipes in OE-Core. This also applies to patches 4 and 5 in this series.

>  	install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
>  	sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
>          sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile
> --
> 2.25.1

//Peter
Changqing Li Dec. 11, 2023, 12:58 a.m. UTC | #2
On 12/9/23 07:35, Peter Kjellerstedt wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
>> -----Original Message-----
>> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Changqing Li
>> Sent: den 8 december 2023 11:13
>> To: openembedded-core@lists.openembedded.org
>> Subject: [OE-core] [PATCH 2/5] base-files: update dirs1777 and volatiles according to VOLATILE_TMP_DIR
>>
>> From: Changqing Li <changqing.li@windriver.com>
>>
>> * update dirs1777 so that only create /var/volatiles/tmp when
>> VOLATILE_TMP_DIR set to yes, create /var/tmp when VOLATILE_TMP_DIR set
>> to no
>>
>> * update volatiles so that only symlink /var/tmp to /var/volatiles/tmp
>> when VOLATILE_TMP_DIR set to yes
>>
>> * mount /tmp as tmpfs fs when VOLATILE_TMP_DIR set to no and init
>> manager is sysvinit
>>
>> Signed-off-by: Changqing Li <changqing.li@windriver.com>
>> ---
>>   meta/recipes-core/base-files/base-files_3.0.14.bb | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
>> index 9fab53ce63..01d076369d 100644
>> --- a/meta/recipes-core/base-files/base-files_3.0.14.bb
>> +++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
>> @@ -30,7 +30,7 @@ S = "${WORKDIR}"
>>   INHIBIT_DEFAULT_DEPS = "1"
>>
>>   docdir:append = "/${P}"
>> -dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
>> +dirs1777 = "/tmp ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_TMP_DIR}') else ''}tmp"
>>   dirs2775 = ""
>>   dirs555 = "/sys /proc"
>>   dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
>> @@ -54,7 +54,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_LOG_DIR}') else ''} \
>> +             ${@'tmp' if oe.types.boolean('${VOLATILE_TMP_DIR}') else ''}"
>>   conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
>>                ${sysconfdir}/issue /${sysconfdir}/issue.net \
>>                ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
>> @@ -122,6 +123,9 @@ do_install () {
>>        fi
>>
>>        install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
>> +    if [ ${@ oe.types.boolean('${VOLATILE_TMP_DIR}') } = False ] && ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'false', 'true', d)} ;then
>> +        echo "tmpfs   /tmp  tmpfs mode=1777,strictatime,nosuid,nodev,size=50%,nr_inodes=1m   0  0" >> ${D}${sysconfdir}/fstab
>> +    fi
> Inconsistent indentation. Please use tabs to indent shell code in
> recipes in OE-Core. This also applies to patches 4 and 5 in this series.

Thanks,  have send an V2 to fix these issue.

//Changqing

>
>>        install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
>>        sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
>>           sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile
>> --
>> 2.25.1
> //Peter
>
diff mbox series

Patch

diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index 9fab53ce63..01d076369d 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -30,7 +30,7 @@  S = "${WORKDIR}"
 INHIBIT_DEFAULT_DEPS = "1"
 
 docdir:append = "/${P}"
-dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
+dirs1777 = "/tmp ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_TMP_DIR}') else ''}tmp"
 dirs2775 = ""
 dirs555 = "/sys /proc"
 dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
@@ -54,7 +54,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_LOG_DIR}') else ''} \
+             ${@'tmp' if oe.types.boolean('${VOLATILE_TMP_DIR}') else ''}"
 conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
              ${sysconfdir}/issue /${sysconfdir}/issue.net \
              ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
@@ -122,6 +123,9 @@  do_install () {
 	fi
 
 	install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
+    if [ ${@ oe.types.boolean('${VOLATILE_TMP_DIR}') } = False ] && ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'false', 'true', d)} ;then
+        echo "tmpfs   /tmp  tmpfs  mode=1777,strictatime,nosuid,nodev,size=50%,nr_inodes=1m   0  0" >> ${D}${sysconfdir}/fstab
+    fi
 	install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
 	sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
         sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile