#----------------------------------------------------------------------------
# /etc/rc.d/rc.scsi - configuration of your scsi card
#
# Creation:	09.03.2001  Kai-Christian Arndt
# Last Update:  01.05.2001  Kai-Christian Arndt
#----------------------------------------------------------------------------

/usr/local/bin/colecho "loading SCSI drivers ..." gn

if [ "$SCSI_DO_DEBUG" = yes ]
then
    set -x
fi

/sbin/insmod scsi_mod   				# load SCSI-lowlevel driver

idx=1

cdrom=no

while [ "$idx" -le "$SCSI_DRV_N" ]
do
    eval drv='$SCSI_DRV_'$idx
    eval opt='$SCSI_DRV_'$idx'_OPTION'

    if [ $j = cdrom ]					# cdrom below
    then
	cdrom=yes
    else
	/sbin/insmod $drv $opt                          # load SCSI-Adapter driver
    fi

    idx=`/usr/bin/expr $idx + 1`
done

/sbin/insmod sd_mod						# load disk driver

if [ "$cdrom" = "yes" ]					# check if cdrom used
then							# yes, load modules
    /sbin/insmod cdrom
    /sbin/insmod sr_mod
    /sbin/insmod isofs
    /bin/mkdir /cdrom
fi

# create disk devices:
# first be sure, that mknod is executable
/bin/chmod 755 /bin/mknod

# now get information about partitions and build the nodes
cat /proc/partitions | grep "^ .* sd[a-z]" | sed -e 's/ \+/ /g;' |
while read line
do
    set $line
    /bin/mknod /dev/$4 b $1 $2 >/dev/null 2>&1
done

# create cdrom devices
for j in 0 1 2 3 4 5 6 7
do
    /bin/mknod /dev/sr$j b 11 $j
done

set +x
