aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorAmadeusz Żołnowski <aidecoe@aidecoe.name>2011-04-17 22:29:12 +0200
committerWilliam Hubbs <williamh@gentoo.org>2011-04-18 15:26:13 -0500
commit64ef51ab09943ec28ddd4cb01647c982970cad9c (patch)
tree914921c42959581a94e9effd955803083c3612df /sh
parent372bae32132ef4866cdff878f5457ec4361c9ddd (diff)
Add support for /run directory
This is a new directory for storing volatile runtime data. See https://lwn.net/Articles/436012 X-Gentoo-Bug: 363971 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=363971
Diffstat (limited to 'sh')
-rw-r--r--sh/init.sh.Linux.in22
1 files changed, 22 insertions, 0 deletions
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 361de0bc..301c42ff 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -91,6 +91,28 @@ 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
+ if [ ! -d /run/lock ]; then
+ mkdir /run/lock
+ chown root:uucp /run/lock
+ chmod 0775 /run/lock
+ fi
+else
+ 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