summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc.etc/init.d/mdev26
1 files changed, 19 insertions, 7 deletions
diff --git a/src.etc/init.d/mdev b/src.etc/init.d/mdev
index 79fbafd..81d004a 100755
--- a/src.etc/init.d/mdev
+++ b/src.etc/init.d/mdev
@@ -3,24 +3,36 @@
start()
{
log 'Enabling device hotplugging'
- if ! mount | grep -Fq ' /dev '; then
- mount -t tmpfs -o noexec,nosuid,mode=0755 tmpfs /dev
+ 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
- printf '/sbin/mdev\n' >/proc/sys/kernel/hotplug
- mdev -s
}
stop()
{
log 'Disabling device hotplugging'
- printf '\n' >/proc/sys/kernel/hotplug
- if mount | grep -Fq ' /dev '; then
- umount /dev
+ 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
}