summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-freebsd/freebsd-sbin/files/devd.initd')
-rw-r--r--sys-freebsd/freebsd-sbin/files/devd.initd50
1 files changed, 50 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-sbin/files/devd.initd b/sys-freebsd/freebsd-sbin/files/devd.initd
new file mode 100644
index 000000000000..b8414abb56b7
--- /dev/null
+++ b/sys-freebsd/freebsd-sbin/files/devd.initd
@@ -0,0 +1,50 @@
+#!/sbin/runscript
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need localmount
+ after bootmisc hostname 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"
+
+ # Flush the output buffer
+ eflush
+
+ /etc/devd_queue flush
+
+ mark_service_starting "${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 :