summaryrefslogtreecommitdiff
blob: dddcfb0084fb4e3fdb6472ddbc48c1d17c667e88 (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
48
49
50
51
52
53
54
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# /space/gentoo/cvsroot/gentoo-x86/sys-apps/hotplug/files/hotplug.rc,v 1.2 2002/02/25 23:02:14 woodchip Exp

HILITE="\033[1m"
NORMAL="\033[0m"

depend() {
	need modules
}

checkconfig() {
	if [ ! -d /etc/hotplug ] ; then
		eerror "Hotplug requires scripts & configs in /etc/hotplug!"
		return 1
	fi
}

start() {
	CMDLINE="`cat /proc/cmdline`"
	for x in $CMDLINE
	do
		if [ "$x" = "nodetect" ]
		then
			ebegin "Skipping USB and PCI hotplugging (nodetect option)"
			return 0
		elif [ "$x" = "nohotplug" ]
		then
			ebegin "Skipping USB and PCI hotplugging (nohotplug option)"
			return 0
		fi
	done
	local error
	checkconfig || return 1
	ebegin "Starting USB and PCI hotplugging"
	echo "0" > /proc/sys/kernel/printk
	for RC in /etc/hotplug/*.rc
	do
		$RC start > /dev/null 2>&1
	done
	echo "6" > /proc/sys/kernel/printk
	eend
}

stop() {
	local error
	ebegin "Stopping USB and PCI hotplugging"
	for RC in /etc/hotplug/*.rc
	do
		$RC stop
	done
	eend
}