summaryrefslogtreecommitdiff
blob: fc495397378a2e18c0261f526c31f8ded28a3b67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need checkfs
}

start() {
	# Mount local filesystems in /etc/fstab.
	ebegin "Mounting local filesystems"
	mount -at noproc,noshm,no${NET_FS_LIST// /,no} >/dev/null
	eend $? "Some local filesystem failed to mount"

	# Make sure we insert usbcore if its a module
	if [[ -f /proc/modules && ! -d /proc/bus/usb ]] ; then
		# >/dev/null to hide errors from non-USB users
		modprobe usbcore &> /dev/null
	fi
	
	# Check what USB fs the kernel support.  Currently
	# 2.5+ kernels, and later 2.4 kernels have 'usbfs',
	# while older kernels have 'usbdevfs'.
	local usbfs=$(grep -Fow usbfs /proc/filesystems ||
		grep -Fow usbdevfs /proc/filesystems)

	if [[ -n ${usbfs} ]] && \
	   [[ -e /proc/bus/usb && ! -e /proc/bus/usb/devices ]]
	then
		ebegin "Mounting USB device filesystem (${usbfs})"
		usbgid=$(awk -F: '/^usb:/{print $3; exit}' /etc/group)
		mount -t ${usbfs} usbfs /proc/bus/usb \
			${usbgid:+-o devmode=0664,devgid=${usbgid}}
		eend $? "Failed to mount USB device filesystem"
	fi

	# Swap on loopback devices, and other weirdnesses
	ebegin "Activating (possibly) more swap"
	/sbin/swapon -a
	eend $?

	# Start dm-crypt mappings, if any
	start_addon dm-crypt
}


# vim:ts=4