#!/bin/sh

die ()
{
    echo "****"
    echo $*
    echo "****"
    exit 1
}

#echo "NO gm_install supported for linux yet."

echo "Making device files in /dev."
for i in 0 1 2 3 4 5 6 7 ; do
 /bin/rm -f /dev/gm$i /dev/gmp$i
 /bin/mknod /dev/gm$i c 41 `expr $i "*" 2`
 chmod a+rw /dev/gm$i
 /bin/mknod /dev/gmp$i c 41 `expr $i "*" 2 + 1`
 chmod a+rw /dev/gmp$i
done
sync
sync
echo "ifconfig myri0 down - in case it was up"
/sbin/ifconfig myri0 down >& /dev/null

if /sbin/lsmod | grep ^gm > /dev/null
then
    echo "Removing existing gm driver."
    /sbin/rmmod gm || die "Could not remove installed GM module."
fi

# Go to sleep for 1 second while module is removing
sleep 1

echo "Adding new GM driver."
/sbin/insmod sbin/gm || die Error installing GM driver module.
echo " "
echo "dmesg | tail -10"
/bin/dmesg | tail -10 
echo " "
echo "Done"
