#!/bin/sh module="pci_arb" device="ARB_DEV" mode="666" # invoke insmod with all arguments we got # and use a pathname, as newer modutils don't look in . by default /sbin/insmod ./$module.ko $* || exit 1 # remove stale nodes rm -f /dev/${device}0 # major number is assigned when the module is loaded # figure it out here major=$(awk "\$2==\"$device\" {print \$1}" /proc/devices) mknod /dev/${device}0 c $major 0 # give appropriate group/permissions, and change the group. # Not all distributions have staff, some have "wheel" instead. # group="staff" # grep -q '^staff:' /etc/group || group="wheel" # chgrp $group /dev/${device}0 chmod $mode /dev/${device}0