2008-10-10 14:07:21 +05:30
|
|
|
#!@PREFIX@/sbin/runscript
|
2009-04-27 13:21:18 +05:30
|
|
|
# Copyright 2007-2009 Roy Marples <roy@marples.name>
|
2008-10-10 14:07:21 +05:30
|
|
|
# All rights reserved. Released under the 2-clause BSD license.
|
|
|
|
|
|
|
|
description="Mount the sys filesystem."
|
|
|
|
|
|
|
|
depend()
|
|
|
|
{
|
2009-01-01 19:57:29 +05:30
|
|
|
keyword noprefix novserver
|
2008-10-10 14:07:21 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2009-04-27 13:21:18 +05:30
|
|
|
if [ -d /sys/kernel/security ] && \
|
|
|
|
! mountinfo -q /sys/kernel/security; then
|
2008-10-10 14:07:21 +05:30
|
|
|
if grep -qs securityfs /proc/filesystems; then
|
|
|
|
ebegin "Mounting security filesystem"
|
2008-11-04 22:37:32 +05:30
|
|
|
mount -n -t securityfs -o nodev,noexec,nosuid \
|
2008-10-10 14:07:21 +05:30
|
|
|
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"
|
2008-11-04 22:37:32 +05:30
|
|
|
mount -n -t debugfs -o nodev,noexec,nosuid \
|
2008-10-10 14:07:21 +05:30
|
|
|
debugfs /sys/kernel/debug
|
|
|
|
eend $?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
|
|
|
local retval
|
|
|
|
mount_sys
|
|
|
|
retval=$?
|
2009-04-27 13:21:18 +05:30
|
|
|
if [ $retval -eq 0 ]; then
|
2008-10-10 14:07:21 +05:30
|
|
|
mount_misc
|
|
|
|
fi
|
2009-04-27 13:21:18 +05:30
|
|
|
return $retval
|
2008-10-10 14:07:21 +05:30
|
|
|
}
|