#!/bin/sh start() { printf 'Enabling device hotplugging... ' if ! mount | grep -Fq ' /dev '; then mount -t tmpfs -o noexec,nosuid,mode=0755 tmpfs /dev 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 fi printf 'done.\n' } restart() { printf 'Recanning devices... ' 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