#!/bin/sh
module="cap"
device="cap"
mode="666"
if grep -q '^staff:' /etc/group; then
group="staff"
else
group="wheel"
fi
/sbin/insmod ./$module.ko $* || exit 1
major=$(awk "\$2==\"$module\" {print \$1}" /proc/devices)
# Remove stale nodes and replace them, then give gid and perms
rm -f /dev/${device}hash
rm -f /dev/${device}use
mknod /dev/${device}hash c $major 0
mknod /dev/${device}use c $major 1
chgrp $group /dev/${device}hash
chgrp $group /dev/${device}use
chmod $mode /dev/${device}hash
chmod $mode /dev/${device}use
|