summaryrefslogtreecommitdiffstats
path: root/src.etc/init.d/mdev
blob: 03315f75c261efd4c38499d369f66232f800b580 (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
#!/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
		rm -Rf /dev/*
		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
}