#!/bin/sh
module="FidTouch"
dev="FidTouch"
mode="664"

# Group: since distributions do it differently, look for staff or use wheel
if grep '^staff:' /etc/group > /dev/null; then
    group="staff"
else
    group="wheel"
fi

grep -w misc /proc/devices > /dev/null || modprobe misc 2> /dev/null
grep -w misc /proc/devices > /dev/null || \
	(echo "This driver requires the misc driver"; exit 1)

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
if [ -f ./$module.o ]; then module=./$module.o; fi
/sbin/insmod -f $module $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"misc\" {print \\$1}"`
minor=`cat /proc/misc | awk "\\$2==\"$dev\" {print \\$1}"`

cd /dev
rm -f $dev
mknod $dev c $major $minor
chmod $mode $dev
chgrp $group $dev
depmod
