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

start()
{
	log 'Enabling device hotplugging'
	if ! [ -e /dev/null ]; then
		mount -t tmpfs -o noexec,nosuid,mode=0755 tmpfs /dev || \
			return ${?}
		if [ -e /proc/sys/kernel/hotplug ]; then
			printf '/sbin/mdev\n' >/proc/sys/kernel/hotplug
		fi
		mdev -s
	fi
}

stop()
{
	log 'Disabling device hotplugging'
	if [ -e /proc/sys/kernel/hotplug ]; then
		printf '\n' >/proc/sys/kernel/hotplug
	fi
	if [ -e /dev/null ]; then
		umount /dev || return ${?}
	fi
}

restart()
{
	log 'Recanning devices'
	if ! [ -e /dev/null ]; then
		mount -t tmpfs -o noexec,nosuid,mode=0755 tmpfs /dev || \
			return ${?}
		if [ -e /proc/sys/kernel/hotplug ]; then
			printf '/sbin/mdev\n' >/proc/sys/kernel/hotplug
		fi
	fi
	mdev -s
}