comparison core/busybox/busybox.mdev @ 554:e135d70987c1

core/busybox: add some services, closes #1663
author David Demelier <markand@malikania.fr>
date Thu, 04 Jul 2019 20:17:00 +0200
parents
children 657ee4987f4d
comparison
equal deleted inserted replaced
553:09c120c271be 554:e135d70987c1
1 #!/bin/sh
2 #
3 # /etc/rc.d/busybox.mdev: run control script for busybox.mdev
4 #
5 # This service is started at early boot stage if the script is marked as
6 # executable. There is no need to specify it in SERVICES through the rc.conf
7 # file.
8 #
9
10 if [ -f /etc/rc.conf ]; then
11 . /etc/rc.conf
12 fi
13
14 : ${BUSYBOX_MDEV_CMD:=/bin/busybox}
15 : ${BUSYBOX_MDEV_ARGS:=-s}
16
17 busybox_mdev_start()
18 {
19 echo "Starting busybox mdev: $BUSYBOX_MDEV_CMD mdev $BUSYBOX_MDEV_ARGS"
20 echo "busybox mdev" > /proc/sys/kernel/hotplug
21 $BUSYBOX_MDEV_CMD mdev $BUSYBOX_MDEV_ARGS
22 }
23
24 busybox_mdev_status()
25 {
26 if grep -q mdev /proc/sys/kernel/hotplug > /dev/null 2>&1; then
27 echo "busybox mdev is enabled"
28 else
29 echo "busybox mdev is not running"
30 fi
31 }
32
33 busybox_mdev_stop()
34 {
35 echo "Stopping busybox mdev."
36 echo "" > /proc/sys/kernel/hotplug
37 }
38
39 busybox_mdev_restart()
40 {
41 busybox_mdev_stop
42 sleep 3
43 busybox_mdev_start
44 }
45
46 case $1 in
47 start)
48 busybox_mdev_start
49 ;;
50 status)
51 busybox_mdev_status
52 ;;
53 stop)
54 busybox_mdev_stop
55 ;;
56 restart)
57 busybox_mdev_restart
58 ;;
59 *)
60 echo "usage: $(basename $0) restart|start|status|stop"
61 ;;
62 esac