#!/bin/sh

module="mmcdev"
device="mmcdev"
group="root"
mode="664"

TYPE=$(uname -r)
TEST=$(grep printk /proc/ksyms | cut -f 2 -d " ")
if [ $TEST == "printk"  ]; then
  # non-decorated kernel symbols
  TYPE=$TYPE
elif [ $(echo $TEST | grep SMP) ]; then
  # SMP kernel with decorated symbols
  TYPE=$TYPE"smp"
else
  # non-SMP kernel with decorated symbols
  TYPE=$TYPE"nosym"
fi

# insert the module in executing kernel
/sbin/insmod -f /usr/hpserver/lib/modules/$TYPE/${module}.o $* || exit 1

# get the major number automatically assigned for us
major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

# Remove stale nodes and replace them, then give gid and perms
rm -f /dev/${device}
mknod /dev/${device} c $major 0
chgrp $group /dev/${device} 
chmod $mode  /dev/${device}
