aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2011-09-06 21:00:08 -0500
committerWilliam Hubbs <williamh@gentoo.org>2011-09-06 21:00:08 -0500
commit5ed4d084d95608e40cb21888c18a8f381a44cd69 (patch)
treec1c389b0938c92e82d94f229c43f521566c89a3c
parent9be1a2a67b840918da752efefc3a21cffda173e6 (diff)
Mount /run as early as possible
This commit moves the code that mounts /run to the earliest possible position in openrc.
-rw-r--r--sh/init-early.sh.Linux.in24
-rw-r--r--sh/init.sh.Linux.in24
2 files changed, 24 insertions, 24 deletions
diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
index f5469511..3a81ef94 100644
--- a/sh/init-early.sh.Linux.in
+++ b/sh/init-early.sh.Linux.in
@@ -5,6 +5,30 @@
: ${CONSOLE:=/dev/console}
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
+# 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
+ fi
+ if [ -d /run/lock ]; then
+ chown root:uucp /run/lock
+ chmod 0775 /run/lock
+ fi
+elif [ -e /run ]; then
+ einfo "Unable to mount /run since it is not a directory"
+fi
+
if [ -e "$RC_LIBEXECDIR"/console/unicode ]; then
termencoding="%G"
kmode="-u"
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index b3574344..d01cc7b7 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -91,30 +91,6 @@ 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
- fi
- if [ -d /run/lock ]; then
- chown root:uucp /run/lock
- chmod 0775 /run/lock
- fi
-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