aboutsummaryrefslogtreecommitdiff
path: root/sh/init.sh.Linux.in
diff options
context:
space:
mode:
Diffstat (limited to 'sh/init.sh.Linux.in')
-rw-r--r--sh/init.sh.Linux.in18
1 files changed, 18 insertions, 0 deletions
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index d01cc7b7..f86c5f26 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 a new directory for storing volatile runtime data.
+# Read more about /run at 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
+ checkpath -d -m 0775 -o root:uucp /run/lock
+elif [ -e /run ]; then
+ einfo "Unable to mount /run since it is not a directory"
+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