summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-06-03 15:58:26 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-06-03 15:58:26 (EDT)
commit06d7b2b5f5fda27c2f5f94e953fd9afe6c643e22 (patch)
tree4e2bf722b91605797c7eede7bca88e0625453848
parentc0f127f5becdd94e65f51b433f103594780a833f (diff)
/etc/init.d/mdev: Make more robust.
-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
}