diff options
author | Roy Marples <roy@marples.name> | 2008-10-10 08:37:21 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-10-10 08:37:21 +0000 |
commit | d6da8e8c48feb8faf9287fc86fbbf0890c37a87c (patch) | |
tree | e6cdf21f0f3a3270b705fe14b876f92b14b38dbf /init.d/sysfs.in | |
parent | 247766695cd7c5e8d83dff72f7eb7e6578bf57b8 (diff) | |
download | openrc-d6da8e8c48feb8faf9287fc86fbbf0890c37a87c.tar.gz openrc-d6da8e8c48feb8faf9287fc86fbbf0890c37a87c.tar.bz2 openrc-d6da8e8c48feb8faf9287fc86fbbf0890c37a87c.tar.xz |
sysinit is now a real runlevel that handles things like udev, dmesg and
mounting various bits in /dev and /sys.
init.sh JUST mounts /lib/rc/init.d (and /proc for Linux systems)
To make development of this easier we now return an empty RC_STRINGLIST
instead of a NULL for empty things.
If you don't have a udev init script installed, don't reboot your box OR
roll back to an older OpenRC version.
Diffstat (limited to 'init.d/sysfs.in')
-rw-r--r-- | init.d/sysfs.in | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/init.d/sysfs.in b/init.d/sysfs.in new file mode 100644 index 0000000..e711aee --- /dev/null +++ b/init.d/sysfs.in @@ -0,0 +1,63 @@ +#!@PREFIX@/sbin/runscript +# Copyright 2007-2008 Roy Marples <roy@marples.name> +# All rights reserved. Released under the 2-clause BSD license. + +description="Mount the sys filesystem." + +depend() +{ + keyword noprefix +} + +mount_sys() +{ + grep -Eq "[[:space:]]+sysfs$" /proc/filesystems || return 1 + mountinfo -q /sys && return 0 + + if [ ! -d /sys ]; then + if ! mkdir -m 0755 /sys; then + ewarn "Could not create /sys!" + return 1 + fi + fi + + ebegin "Mounting /sys" + if ! fstabinfo --mount /sys; then + mount -n -t sysfs -o noexec,nosuid,nodev sysfs /sys + fi + eend $? +} + +mount_misc() +{ + # Setup Kernel Support for securityfs + if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then + if grep -qs securityfs /proc/filesystems; then + ebegin "Mounting security filesystem" + mount -t securityfs -o nodev,noexec,nosuid \ + securityfs /sys/kernel/security + eend $? + fi + fi + + # Setup Kernel Support for debugfs + if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug; then + if grep -qs debugfs /proc/filesystems; then + ebegin "Mounting debug filesystem" + mount -t debugfs -o nodev,noexec,nosuid \ + debugfs /sys/kernel/debug + eend $? + fi + fi +} + +start() +{ + local retval + mount_sys + retval=$? + if [ ${retval} -eq 0 ]; then + mount_misc + fi + return ${retval} +} |