[isar-cip-core][PATCH] tmp-fs: Use systemd tmp.mount


Quirin Gylstorff
 

From: Quirin Gylstorff <quirin.gylstorff@...>

Debian moves in [1] the tmp.mount to /usr/share.

To use sane defaults use the by systemd provided version of tmp.mount.

To overwrite the options use a drop-in file as described in [2].

[1]: https://salsa.debian.org/systemd-team/systemd/-/commit/5a9a0e7d25ac7ff0f1113ddb4219cc554b20dffa
[2]: https://www.freedesktop.org/software/systemd/man/systemd.unit.html

Closes https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/46

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@...>
---
recipes-core/tmp-fs/files/postinst | 4 ++++
recipes-core/tmp-fs/files/tmp.mount.tmpl | 11 -----------
recipes-core/tmp-fs/tmp-fs_0.1.bb | 12 +-----------
3 files changed, 5 insertions(+), 22 deletions(-)
delete mode 100644 recipes-core/tmp-fs/files/tmp.mount.tmpl

diff --git a/recipes-core/tmp-fs/files/postinst b/recipes-core/tmp-fs/files/postinst
index 07017fd..2db15ca 100755
--- a/recipes-core/tmp-fs/files/postinst
+++ b/recipes-core/tmp-fs/files/postinst
@@ -1,3 +1,7 @@
#!/bin/sh

+if [ ! -e /etc/systemd/system/tmp.mount ]; then
+ cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
+fi
+
deb-systemd-helper enable tmp.mount || true
diff --git a/recipes-core/tmp-fs/files/tmp.mount.tmpl b/recipes-core/tmp-fs/files/tmp.mount.tmpl
deleted file mode 100644
index be5e663..0000000
--- a/recipes-core/tmp-fs/files/tmp.mount.tmpl
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=Create /tmp
-
-[Mount]
-What=tmpfs
-Where=/tmp
-Type=tmpfs
-Options=${TMP_FS_OPTIONS}
-
-[Install]
-WantedBy=local-fs.target
diff --git a/recipes-core/tmp-fs/tmp-fs_0.1.bb b/recipes-core/tmp-fs/tmp-fs_0.1.bb
index b86b0fb..87d04b9 100644
--- a/recipes-core/tmp-fs/tmp-fs_0.1.bb
+++ b/recipes-core/tmp-fs/tmp-fs_0.1.bb
@@ -10,17 +10,7 @@

inherit dpkg-raw

-SRC_URI = "file://postinst \
- file://tmp.mount.tmpl"
+SRC_URI = "file://postinst"

-TMP_FS_SIZE ?= "500M"
-TMP_FS_MODE ?= "755"
-TMP_FS_OPTIONS = "nodev,nosuid,size=${TMP_FS_SIZE},mode=${TMP_FS_MODE}"

-TEMPLATE_FILES = "tmp.mount.tmpl"
-TEMPLATE_VARS += "TMP_FS_OPTIONS"

-do_install[cleandirs]+="${D}/lib/systemd/system"
-do_install() {
- install -m 0644 ${WORKDIR}/tmp.mount ${D}/lib/systemd/system/tmp.mount
-}
--
2.35.1


Jan Kiszka
 

On 04.11.22 14:07, Quirin Gylstorff wrote:
From: Quirin Gylstorff <quirin.gylstorff@...>

Debian moves in [1] the tmp.mount to /usr/share.

To use sane defaults use the by systemd provided version of tmp.mount.

To overwrite the options use a drop-in file as described in [2].

[1]: https://salsa.debian.org/systemd-team/systemd/-/commit/5a9a0e7d25ac7ff0f1113ddb4219cc554b20dffa
[2]: https://www.freedesktop.org/software/systemd/man/systemd.unit.html

Closes https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/46

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@...>
---
recipes-core/tmp-fs/files/postinst | 4 ++++
recipes-core/tmp-fs/files/tmp.mount.tmpl | 11 -----------
recipes-core/tmp-fs/tmp-fs_0.1.bb | 12 +-----------
3 files changed, 5 insertions(+), 22 deletions(-)
delete mode 100644 recipes-core/tmp-fs/files/tmp.mount.tmpl

diff --git a/recipes-core/tmp-fs/files/postinst b/recipes-core/tmp-fs/files/postinst
index 07017fd..2db15ca 100755
--- a/recipes-core/tmp-fs/files/postinst
+++ b/recipes-core/tmp-fs/files/postinst
@@ -1,3 +1,7 @@
#!/bin/sh

+if [ ! -e /etc/systemd/system/tmp.mount ]; then
+ cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
+fi
+
deb-systemd-helper enable tmp.mount || true
diff --git a/recipes-core/tmp-fs/files/tmp.mount.tmpl b/recipes-core/tmp-fs/files/tmp.mount.tmpl
deleted file mode 100644
index be5e663..0000000
--- a/recipes-core/tmp-fs/files/tmp.mount.tmpl
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=Create /tmp
-
-[Mount]
-What=tmpfs
-Where=/tmp
-Type=tmpfs
-Options=${TMP_FS_OPTIONS}
-
-[Install]
-WantedBy=local-fs.target
diff --git a/recipes-core/tmp-fs/tmp-fs_0.1.bb b/recipes-core/tmp-fs/tmp-fs_0.1.bb
index b86b0fb..87d04b9 100644
--- a/recipes-core/tmp-fs/tmp-fs_0.1.bb
+++ b/recipes-core/tmp-fs/tmp-fs_0.1.bb
@@ -10,17 +10,7 @@

inherit dpkg-raw

-SRC_URI = "file://postinst \
- file://tmp.mount.tmpl"
+SRC_URI = "file://postinst"

-TMP_FS_SIZE ?= "500M"
-TMP_FS_MODE ?= "755"
-TMP_FS_OPTIONS = "nodev,nosuid,size=${TMP_FS_SIZE},mode=${TMP_FS_MODE}"

-TEMPLATE_FILES = "tmp.mount.tmpl"
-TEMPLATE_VARS += "TMP_FS_OPTIONS"

-do_install[cleandirs]+="${D}/lib/systemd/system"
-do_install() {
- install -m 0644 ${WORKDIR}/tmp.mount ${D}/lib/systemd/system/tmp.mount
-}
I think we need an empty do_install, or
https://github.com/ilbers/isar/blob/master/meta/classes/dpkg-raw.bbclass#L12
will kick in.

Jan

--
Siemens AG, Technology
Competence Center Embedded Linux