2013-12-21 14:51:11 -06:00
|
|
|
#!@SBINDIR@/openrc-run
|
2009-05-01 15:11:40 +01:00
|
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
2011-06-29 19:46:31 -04:00
|
|
|
# Released under the 2-clause BSD license.
|
2007-11-23 12:04:11 +00:00
|
|
|
|
|
|
|
description="Mounts misc filesystems in /proc."
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
depend()
|
|
|
|
{
|
2009-05-11 15:31:52 +01:00
|
|
|
use modules devfs
|
2008-03-02 21:13:21 +00:00
|
|
|
need localmount
|
2012-07-02 22:04:22 -05:00
|
|
|
keyword -openvz -prefix -vserver -lxc
|
2007-11-23 12:04:11 +00:00
|
|
|
}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
start()
|
|
|
|
{
|
2010-01-08 03:39:25 -05:00
|
|
|
# Make sure we insert usbcore if it's a module
|
2011-04-17 09:12:20 -04:00
|
|
|
if [ -f /proc/modules -a ! -d /sys/module/usbcore -a ! -d /proc/bus/usb ]; then
|
2007-11-23 12:04:11 +00:00
|
|
|
modprobe -q usbcore
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ -e /proc/filesystems ] || return 0
|
|
|
|
|
|
|
|
# Setup Kernel Support for miscellaneous Binary Formats
|
2011-09-18 15:50:12 -04:00
|
|
|
if [ -d /proc/sys/fs/binfmt_misc -a ! -e /proc/sys/fs/binfmt_misc/register ]; then
|
2007-11-28 15:45:03 +00:00
|
|
|
if grep -qs binfmt_misc /proc/filesystems; then
|
2007-11-23 12:04:11 +00:00
|
|
|
ebegin "Mounting misc binary format filesystem"
|
|
|
|
mount -t binfmt_misc -o nodev,noexec,nosuid \
|
|
|
|
binfmt_misc /proc/sys/fs/binfmt_misc
|
2011-09-18 15:29:01 -04:00
|
|
|
if eend $? ; then
|
|
|
|
local fmts
|
|
|
|
ebegin "Loading custom binary format handlers"
|
|
|
|
fmts=$(grep -hsv -e '^[#;]' -e '^[[:space:]]*$' \
|
|
|
|
/run/binfmt.d/*.conf \
|
2013-02-11 22:13:30 -05:00
|
|
|
/etc/binfmt.d/*.conf \
|
2011-09-18 15:29:01 -04:00
|
|
|
""/usr/lib/binfmt.d/*.conf)
|
|
|
|
if [ -n "${fmts}" ]; then
|
|
|
|
echo "${fmts}" > /proc/sys/fs/binfmt_misc/register
|
|
|
|
fi
|
|
|
|
eend $?
|
|
|
|
fi
|
2007-11-23 12:04:11 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-04-13 23:01:42 +03:00
|
|
|
[ "$RC_SYS" = "OPENVZ" ] && return 0
|
2012-02-15 09:00:23 -06:00
|
|
|
|
|
|
|
# Check what USB fs the kernel support. Currently
|
|
|
|
# 2.5+ kernels, and later 2.4 kernels have 'usbfs',
|
|
|
|
# while older kernels have 'usbdevfs'.
|
|
|
|
if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then
|
|
|
|
local usbfs=$(grep -Fow usbfs /proc/filesystems ||
|
|
|
|
grep -Fow usbdevfs /proc/filesystems)
|
|
|
|
if [ -n "$usbfs" ]; then
|
|
|
|
ebegin "Mounting USB device filesystem [$usbfs]"
|
|
|
|
local usbgid="$(getent group usb | \
|
|
|
|
sed -e 's/.*:.*:\(.*\):.*/\1/')"
|
|
|
|
mount -t $usbfs \
|
|
|
|
-o ${usbgid:+devmode=0664,devgid=$usbgid,}noexec,nosuid \
|
|
|
|
usbfs /proc/bus/usb
|
|
|
|
eend $?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2007-11-23 12:04:11 +00:00
|
|
|
# Setup Kernel Support for SELinux
|
2014-04-19 21:18:18 +02:00
|
|
|
if [ -d /sys/fs/selinux ] && ! mountinfo -q /sys/fs/selinux; then
|
2007-11-28 15:45:03 +00:00
|
|
|
if grep -qs selinuxfs /proc/filesystems; then
|
2007-11-23 12:04:11 +00:00
|
|
|
ebegin "Mounting SELinux filesystem"
|
2014-04-19 21:18:18 +02:00
|
|
|
mount -t selinuxfs selinuxfs /sys/fs/selinux
|
2007-11-23 12:04:11 +00:00
|
|
|
eend $?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|