LJ Archive

Listing 1. Script to Create a /dev Entry Point

#!/bin/sh

if [ "x$1" = "x" ]; then
   echo "usage: load_misc <module> [<mode>\
    [<owner> [<group>]]]"
fi
insmod $1 || exit 1
major=10
minor=`grep $DEV /proc/devices |
   awk "{print \\$1}"`
mknod /dev/$1 c $major $minor
if [ "x$2" != "x"]; then
   chmod $2 /dev/$1
fi
if [ "x$3" != "x"]; then
   chown $3 /dev/$1
fi
if [ "x$4" != "x"]; then
   chgrp $4 /dev/$1
fi
exit 0
LJ Archive