2013-12-22 02:21:11 +05:30
|
|
|
#!@SBINDIR@/openrc-run
|
2009-05-01 19:41:40 +05:30
|
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
2011-06-30 05:16:31 +05:30
|
|
|
# Released under the 2-clause BSD license.
|
2007-11-23 17:34:11 +05:30
|
|
|
|
|
|
|
description="Mounts misc filesystems in /proc."
|
|
|
|
|
2008-01-11 17:43:46 +05:30
|
|
|
depend()
|
|
|
|
{
|
2009-05-11 20:01:52 +05:30
|
|
|
use modules devfs
|
2008-03-03 02:43:21 +05:30
|
|
|
need localmount
|
2012-07-03 08:34:22 +05:30
|
|
|
keyword -openvz -prefix -vserver -lxc
|
2007-11-23 17:34:11 +05:30
|
|
|
}
|
|
|
|
|
2008-01-11 17:43:46 +05:30
|
|
|
start()
|
|
|
|
{
|
2010-01-08 14:09:25 +05:30
|
|
|
# Make sure we insert usbcore if it's a module
|
2011-04-17 18:42:20 +05:30
|
|
|
if [ -f /proc/modules -a ! -d /sys/module/usbcore -a ! -d /proc/bus/usb ]; then
|
2007-11-23 17:34:11 +05:30
|
|
|
modprobe -q usbcore
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ -e /proc/filesystems ] || return 0
|
|
|
|
|
|
|
|
# Setup Kernel Support for miscellaneous Binary Formats
|
2011-09-19 01:20:12 +05:30
|
|
|
if [ -d /proc/sys/fs/binfmt_misc -a ! -e /proc/sys/fs/binfmt_misc/register ]; then
|
2007-11-28 21:15:03 +05:30
|
|
|
if grep -qs binfmt_misc /proc/filesystems; then
|
2007-11-23 17:34:11 +05:30
|
|
|
ebegin "Mounting misc binary format filesystem"
|
|
|
|
mount -t binfmt_misc -o nodev,noexec,nosuid \
|
|
|
|
binfmt_misc /proc/sys/fs/binfmt_misc
|
2011-09-19 00:59:01 +05:30
|
|
|
if eend $? ; then
|
|
|
|
local fmts
|
|
|
|
ebegin "Loading custom binary format handlers"
|
|
|
|
fmts=$(grep -hsv -e '^[#;]' -e '^[[:space:]]*$' \
|
|
|
|
/run/binfmt.d/*.conf \
|
2013-02-12 08:43:30 +05:30
|
|
|
/etc/binfmt.d/*.conf \
|
2011-09-19 00:59:01 +05:30
|
|
|
""/usr/lib/binfmt.d/*.conf)
|
|
|
|
if [ -n "${fmts}" ]; then
|
|
|
|
echo "${fmts}" > /proc/sys/fs/binfmt_misc/register
|
|
|
|
fi
|
|
|
|
eend $?
|
|
|
|
fi
|
2007-11-23 17:34:11 +05:30
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-04-14 01:31:42 +05:30
|
|
|
[ "$RC_SYS" = "OPENVZ" ] && return 0
|
2012-02-15 20:30:23 +05:30
|
|
|
|
|
|
|
# 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 17:34:11 +05:30
|
|
|
# Setup Kernel Support for SELinux
|
2014-04-20 00:48:18 +05:30
|
|
|
if [ -d /sys/fs/selinux ] && ! mountinfo -q /sys/fs/selinux; then
|
2007-11-28 21:15:03 +05:30
|
|
|
if grep -qs selinuxfs /proc/filesystems; then
|
2007-11-23 17:34:11 +05:30
|
|
|
ebegin "Mounting SELinux filesystem"
|
2014-04-20 00:48:18 +05:30
|
|
|
mount -t selinuxfs selinuxfs /sys/fs/selinux
|
2007-11-23 17:34:11 +05:30
|
|
|
eend $?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|