From b3a772202e83ce2c1c12df0a0e910258828bcecc 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 and create /run/lock 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. We also create /run/lock if it doesn't exist and make sure it has correct owner and mode bits. See https://lwn.net/Articles/436012/ for more information on /run. --- sh/init.sh.Linux.in | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in index 361de0b..0066d03 100644 --- a/sh/init.sh.Linux.in +++ b/sh/init.sh.Linux.in @@ -91,6 +91,31 @@ 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/ +# +# We also create /run/lock if it doesn't exist and make sure it has +# correct owner and mode bits. +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 + + [ -d /run/lock ] || mkdir /run/lock + chown root.uucp /run/lock + chmod 0755 /run/lock +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