[isar-cip-core][PATCH v2] 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

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@...>
---

Changes in v2:
- increased recipe version
- added empty do_install to avoid log message

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 | 26 ------------------------
recipes-core/tmp-fs/tmp-fs_0.2.bb | 16 +++++++++++++++
4 files changed, 20 insertions(+), 37 deletions(-)
delete mode 100644 recipes-core/tmp-fs/files/tmp.mount.tmpl
delete mode 100644 recipes-core/tmp-fs/tmp-fs_0.1.bb
create mode 100644 recipes-core/tmp-fs/tmp-fs_0.2.bb

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
deleted file mode 100644
index b86b0fb..0000000
--- a/recipes-core/tmp-fs/tmp-fs_0.1.bb
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# CIP Core, generic profile
-#
-# Copyright (c) Siemens AG, 2021
-#
-# Authors:
-# Quirin Gylstorff <quirin.gylstorff@...>
-#
-# SPDX-License-Identifier: MIT
-
-inherit dpkg-raw
-
-SRC_URI = "file://postinst \
- file://tmp.mount.tmpl"
-
-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
-}
diff --git a/recipes-core/tmp-fs/tmp-fs_0.2.bb b/recipes-core/tmp-fs/tmp-fs_0.2.bb
new file mode 100644
index 0000000..bb5fcce
--- /dev/null
+++ b/recipes-core/tmp-fs/tmp-fs_0.2.bb
@@ -0,0 +1,16 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2021
+#
+# Authors:
+# Quirin Gylstorff <quirin.gylstorff@...>
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-raw
+
+SRC_URI = "file://postinst"
+
+do_install() {
+}
--
2.35.1


Jan Kiszka
 

On 07.11.22 10:31, 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

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@...>
---

Changes in v2:
- increased recipe version
- added empty do_install to avoid log message

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 | 26 ------------------------
recipes-core/tmp-fs/tmp-fs_0.2.bb | 16 +++++++++++++++
4 files changed, 20 insertions(+), 37 deletions(-)
delete mode 100644 recipes-core/tmp-fs/files/tmp.mount.tmpl
delete mode 100644 recipes-core/tmp-fs/tmp-fs_0.1.bb
create mode 100644 recipes-core/tmp-fs/tmp-fs_0.2.bb

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
deleted file mode 100644
index b86b0fb..0000000
--- a/recipes-core/tmp-fs/tmp-fs_0.1.bb
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# CIP Core, generic profile
-#
-# Copyright (c) Siemens AG, 2021
-#
-# Authors:
-# Quirin Gylstorff <quirin.gylstorff@...>
-#
-# SPDX-License-Identifier: MIT
-
-inherit dpkg-raw
-
-SRC_URI = "file://postinst \
- file://tmp.mount.tmpl"
-
-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
-}
diff --git a/recipes-core/tmp-fs/tmp-fs_0.2.bb b/recipes-core/tmp-fs/tmp-fs_0.2.bb
new file mode 100644
index 0000000..bb5fcce
--- /dev/null
+++ b/recipes-core/tmp-fs/tmp-fs_0.2.bb
@@ -0,0 +1,16 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2021
+#
+# Authors:
+# Quirin Gylstorff <quirin.gylstorff@...>
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-raw
+
+SRC_URI = "file://postinst"
+
+do_install() {
+}
Thanks, applied.

Jan

--
Siemens AG, Technology
Competence Center Embedded Linux