From 9de16d22b0ac3cbb74793faa913db889d8151ee5 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 04 Jun 2014 23:08:41 -0400 Subject: Merge branch 'feature/init-system-improvements'. --- (limited to 'src.etc/init.d/mdev') diff --git a/src.etc/init.d/mdev b/src.etc/init.d/mdev index 8052c3b..81d004a 100755 --- a/src.etc/init.d/mdev +++ b/src.etc/init.d/mdev @@ -1,53 +1,38 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common start() { - printf 'Enabling device hotplugging... ' - - if ! mount | grep -Fq ' /dev '; then - mount -t tmpfs -o noexec,nosuid,mode=0755 tmpfs /dev + 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 - - 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 -Fq ' /dev '; then - umount /dev + 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 - - printf 'done.\n' } restart() { - printf 'Recanning devices... ' - + 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 - - printf 'done.\n' } - -case "${1}" in - start) - start - ;; - stop) - stop - ;; - restart) - restart - ;; - *) - printf 'Usage: %s {start|stop|restart}\n' "${0}" >&2 - exit 1 - ;; -esac -- cgit v0.9.1