xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-core/busybox/files/mdev (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2#
3# Run the mdev daemon
4#
5
6DAEMON="mdev"
7PIDFILE="/var/run/$DAEMON.pid"
8
9
10start() {
11  echo -n "Starting $DAEMON... "
12  start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
13  [ $? -eq 0 ] && echo "OK" || echo "ERROR"
14
15  # coldplug modules
16  find /sys/ -name modalias -print0 | \
17    xargs -0 sort -u | \
18    tr '\n' '\0' | \
19    xargs -0 modprobe -abq
20}
21
22stop() {
23  echo -n "Stopping $DAEMON... "
24  start-stop-daemon -K -p $PIDFILE
25  [ $? -eq 0 ] && echo "OK" || echo "ERROR"
26}
27
28restart() {
29  stop
30  start
31}
32
33case "$1" in
34  start|stop|restart)
35  "$1"
36  ;;
37  *)
38  echo "Usage: $0 {start|stop|restart}"
39  exit 1
40esac
41
42exit $?
43
44