From 4e5bdf837640e917165ef41a446f7e2ede4fb6c3 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 14 Mar 2024 18:34:23 +0100 Subject: [PATCH] Creating /etc/systemd/system/tmp.mount.d/mount_options.conf in snippets/tpl.075.tmp-tmpfs.sh --- snippets/tpl.075.tmp-tmpfs.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/snippets/tpl.075.tmp-tmpfs.sh b/snippets/tpl.075.tmp-tmpfs.sh index e16c8fa..c159e8c 100644 --- a/snippets/tpl.075.tmp-tmpfs.sh +++ b/snippets/tpl.075.tmp-tmpfs.sh @@ -10,7 +10,22 @@ setup_tmp_tmpfs() { echo log "Setting up /tmp as a tmpfs by a systemd mount unit ..." echo + if [[ ! -d /etc/systemd/system/tmp.mount.d ]] ; then + echo "Creating /etc/systemd/system/tmp.mount.d ..." + mkdir -pv /etc/systemd/system/tmp.mount.d + echo + fi + echo "Creating /etc/systemd/system/tmp.mount.d/mount_options.conf ..." + echo + cat <<-EOF >"/etc/systemd/system/tmp.mount.d/mount_options.conf" + [Mount] + Options=mode=1777,strictatime,nosuid,nodev,size=10%%,nr_inodes=1m + EOF + echo + echo "Content of /etc/systemd/system/tmp.mount.d/mount_options.conf:" + cat /etc/systemd/system/tmp.mount.d/mount_options.conf + echo echo "Enabling unit tmp.mount ..." systemctl enable tmp.mount -- 2.39.5