summaryrefslogtreecommitdiff
blob: d22a59ea6ea3b2fe88d322087a9e53a2c4033f89 (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-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need localmount
	after bootmisc hostname
	before net
}

start() {
	# Services may depend on us, so mark us as inactive
	mark_service_inactive "${SVCNAME}"

	# Create a queue so that if things went UP DOWN UP DOWN UP DOWN UP
	# We just do an UP
	# This is used by /etc/devd_queue
	mkdir -p /var/run/devd

	ebegin "Starting the Device State Change Daemon"
	sysctl hw.bus.devctl_disable=0 >/dev/null
	start-stop-daemon --start --exec /sbin/devd \
		--pidfile /var/run/devd.pid
	eend $? "Failed to start devd" \
	|| return $?

	ebegin "Waiting for Device State Change Daemon to settle"
	LC_ALL=C sleep "${DEVD_WAIT:-2}"
	eend $?

	# Now flush the queue
	einfo "Flushing Device State Change Daemon queue"
	/etc/devd_queue flush

	mark_service_started "${SVCNAME}"
	return 0
}

stop() {
	ebegin "Stopping the Device State Change Daemon"
	sysctl hw.bus.devctl_disable=1 >/dev/null
	start-stop-daemon --stop --exec /sbin/devd \
		--pidfile /var/run/devd.pid
	eend $? $"Failed to stop devd"
}

# vim: ts=4 :