2012-11-02 17:30:32 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: boot.udev
|
|
|
|
# Required-Start:
|
|
|
|
# Required-Stop:
|
|
|
|
# Should-Start:
|
|
|
|
# Should-Stop:
|
|
|
|
# Default-Start: B
|
|
|
|
# Default-Stop:
|
|
|
|
# Short-Description: manage /dev and kernel device-events
|
|
|
|
# Description: udevd daemon to manage /dev and kernel device events
|
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
. /etc/rc.status
|
|
|
|
|
2013-01-08 21:14:07 +01:00
|
|
|
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
|
|
|
|
DAEMON="@@SYSTEMD@@/systemd-udevd"
|
|
|
|
UDEVADM="@@BINDIR@@/udevadm"
|
|
|
|
WRITERULE="@@PREFIX@@/write_dev_root_rule"
|
2012-11-02 17:30:32 +01:00
|
|
|
udev_timeout=180
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
# create /dev/root symlink with dynamic rule
|
2013-01-08 21:14:07 +01:00
|
|
|
if [ -x ${WRITERULE} ]; then
|
|
|
|
${WRITERULE} >/dev/null 2>&1 || true
|
2012-11-02 17:30:32 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# start udevd
|
|
|
|
echo -n "Starting udevd: "
|
2013-01-08 21:14:07 +01:00
|
|
|
${DAEMON} --daemon
|
2012-11-02 17:30:32 +01:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
rc_status -v
|
|
|
|
rc_exit
|
|
|
|
fi
|
|
|
|
rc_status -v
|
|
|
|
|
|
|
|
# trigger events for all devices
|
|
|
|
echo -n "Loading drivers, configuring devices: "
|
2013-01-08 21:14:07 +01:00
|
|
|
${UDEVADM} trigger --type=subsystems --action=add
|
|
|
|
${UDEVADM} trigger --type=devices --action=add
|
2012-11-02 17:30:32 +01:00
|
|
|
|
|
|
|
# wait for events to finish
|
2013-01-08 21:14:07 +01:00
|
|
|
${UDEVADM} settle --timeout=$udev_timeout
|
2012-11-02 17:30:32 +01:00
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo -n "Stopping udevd: "
|
2013-01-08 21:14:07 +01:00
|
|
|
killproc ${DAEMON}
|
2012-11-02 17:30:32 +01:00
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
echo -n "Restarting udevd: "
|
2013-01-08 21:14:07 +01:00
|
|
|
killproc ${DAEMON}
|
|
|
|
${DAEMON} --daemon
|
2012-11-02 17:30:32 +01:00
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
echo -n "Checking for udevd: "
|
2013-01-08 21:14:07 +01:00
|
|
|
checkproc ${DAEMON}
|
2012-11-02 17:30:32 +01:00
|
|
|
rc_status -v
|
|
|
|
;;
|
2013-01-08 21:14:07 +01:00
|
|
|
reload|force-reload)
|
|
|
|
echo -n "Reloading udevd: "
|
|
|
|
killproc -G -HUP ${DAEMON}
|
2012-11-02 17:30:32 +01:00
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|restart|status|reload|force-reload}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
rc_exit
|