#!/bin/sh
#
# Adds the Quantis driver (already in the correct system directories)
# to the running kernel.

#set -x

#To have a link /dev/qrandom0 automatically set to
#the real device.
#
grep qrandom /etc/devlink.tab > /dev/null
if [ "$?" -eq "0" ]; then
  echo "qrandom entry already in /etc/devlink.tab"
else
  # Warning: 'space' betweed "pci179a,1" and "qrandom" MUST be a TAB!
  echo "type=ddi_pseudo;name=pci179a,1	qrandom\N0" >> /etc/devlink.tab
fi

if [ "${BASEDIR:=/}" = "/" ]; then
  ADD_DRV="add_drv"
else
  ADD_DRV="add_drv -b ${BASEDIR}"
fi
${ADD_DRV} -v -i '"pci179a,1"' -m '* 0444 root sys' quantis
RC=$?
exit $RC
