summaryrefslogtreecommitdiffstats
path: root/src.etc/init.d/mdev
blob: ddb4586575b40f64adf72498e244b2fc7043bbf8 (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
#!/bin/sh

start()
{
	printf 'Enabling device hotplugging... '

	if ! mount | grep -F ' /dev ' >dev/null 2>&1; then
		mount -t tmpfs -o noexec,nosuid,mode=0755 tmpfs /dev
	fi

	printf '/sbin/mdev\n' >/proc/sys/kernel/hotplug
	mdev -s

	printf 'done.\n'
}

stop()
{
	printf 'Disabling device hotplugging... '

	printf '\n' >/proc/sys/kernel/hotplug

	if mount | grep -F ' /dev ' >dev/null 2>&1; then
		umount /dev
	fi

	printf 'done.\n'
}

case "${1}" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	*)
		printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2
		exit 1
		;;
esac