#!/bin/sh

if [ ! -x /sbin/mdev ]
then
    exit 0
fi

case "$1" in
    start)
        echo "/sbin/mdev" > /proc/sys/kernel/hotplug
        
        # put /dev in a tmpfs
        mount -n -o mode=0755 -t tmpfs mdev /dev

        # Create static device nodes in /dev
        mknod /dev/console c 5 1
        chmod 600 /dev/console
        mknod /dev/null c 1 3
        chmod 666 /dev/null

        # make and mount devpts
        mkdir /dev/pts
        mount -n -t devpts devpts /dev/pts

        echo "Starting the hotplug events dispatcher mdev"
        /sbin/mdev -s

        mkdir /dev/shm
        ;;
    stop)
        ;;
    *)
        echo "Usage: /etc/rc.d/init.d/mdev {start|stop}"
        echo 
        exit 1
        ;;
esac

exit 0
