82d3918d7a
If you are not using linux, this should not affect you. If you are using linux, from this point forward, openrc requires the /run directory to be a mounted tmpfs. If it is, you can run @LIBEXECDIR@/sh/migrate-to-run.sh as root to migrate your dependency tree and state information to the new location. If it is not, you must create the /run directory as root with permissions 755 then reboot your system. reported-by: Maxim Kammerer <mk@dee.su> X-Gentoo-Bug: 401059 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=401059
80 lines
2.2 KiB
Plaintext
80 lines
2.2 KiB
Plaintext
#!@SHELL@
|
|
# Copyright (c) 1999-2007 Gentoo Foundation
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
|
# Released under the 2-clause BSD license.
|
|
|
|
. "$RC_LIBEXECDIR"/sh/functions.sh
|
|
[ -r /etc/rc.conf ] && . /etc/rc.conf
|
|
|
|
# By default VServer already has /proc mounted, but OpenVZ does not!
|
|
# However, some of our users have an old proc image in /proc
|
|
# NFC how they managed that, but the end result means we have to test if
|
|
# /proc actually works or not. We do this by comparing two reads of
|
|
# /proc/self/environ for which we have set the variable VAR to two
|
|
# different values. If the comparison comes back equal, we know that
|
|
# /proc is not working.
|
|
mountproc=true
|
|
f=/proc/self/environ
|
|
if [ -e $f ]; then
|
|
if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then
|
|
eerror "You have cruft in /proc that should be deleted"
|
|
else
|
|
einfo "/proc is already mounted"
|
|
mountproc=false
|
|
fi
|
|
fi
|
|
unset f
|
|
|
|
if $mountproc; then
|
|
procfs="proc"
|
|
[ "$RC_UNAME" = "GNU/kFreeBSD" ] && proc="linprocfs"
|
|
ebegin "Mounting /proc"
|
|
if ! fstabinfo --mount /proc; then
|
|
mount -n -t "$procfs" -o noexec,nosuid,nodev proc /proc
|
|
fi
|
|
eend $?
|
|
fi
|
|
|
|
# /run is a new directory for storing volatile runtime data.
|
|
# Read more about /run at https://lwn.net/Articles/436012
|
|
if [ ! -d /run ]; then
|
|
eerror "The /run directory does not exist. Unable to continue."
|
|
return 1
|
|
fi
|
|
|
|
if mountinfo -q /run; then
|
|
einfo "/run is already mounted, skipping"
|
|
else
|
|
ebegin "Mounting /run"
|
|
rc=0
|
|
if ! fstabinfo --mount /run; then
|
|
mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
|
|
rc=$?
|
|
fi
|
|
if [ $rc != 0 ]; then
|
|
eerror "Unable to mount tmpfs on /run."
|
|
eerror "Can't continue."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
checkpath -d $RC_SVCDIR
|
|
checkpath -d -m 0775 -o root:uucp /run/lock
|
|
|
|
# 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
|
|
ebegin "Mounting xenfs"
|
|
if ! fstabinfo --mount /proc/xen; then
|
|
mount -n -t xenfs xenfs /proc/xen -o nosuid,nodev,noexec
|
|
fi
|
|
eend $?
|
|
fi
|
|
|
|
if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
|
|
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
|
|
fi
|
|
|
|
echo sysinit >"$RC_SVCDIR"/softlevel
|
|
exit 0
|