From d07c5633db85d7a2a278f3df9c1ad52e60fe002c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= Date: Sun, 17 Apr 2011 22:29:12 +0200 Subject: [PATCH] Mount tmpfs on /run if directory exists and not already mounted. See https://lwn.net/Articles/436012/ for more information on /run. --- sh/init.sh.Linux.in | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in index 361de0b..2b44a42 100644 --- a/sh/init.sh.Linux.in +++ b/sh/init.sh.Linux.in @@ -91,6 +91,24 @@ if $mountproc; then eend $? fi +# Mount tmpfs on /run when directory exists. /run is used among others +# by udev and dracut, but they fall back to /dev/.{udev,initramfs} if +# /run doesn't exists. +# Read more about /run on LWN.net: https://lwn.net/Articles/436012/ +if [ -d /run ]; then + if mountinfo -q /run; then + einfo "/run is already mounted, skipping" + else + ebegin "Mounting /run" + if ! fstabinfo --mount /run; then + mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run + fi + eend $? + fi +else + einfo "/run is not writable directory, not mounting" +fi + # Try to mount xenfs as early as possible, otherwise rc_sys() will always # return RC_SYS_XENU and will think that we are in a domU while it's not. if grep -Eq "[[:space:]]+xenfs$" /proc/filesystems; then -- 1.7.5.rc1