#------------------------------------------------------------------------------
# /etc/rc.d/rc030.mount - mount data-partition and cdrom
#
# Creation:	    24.09.2003  hs
# Last Update:  $Id: rc030.mount 10092 2005-10-26 09:29:21Z jw5 $
#------------------------------------------------------------------------------

case $OPT_MOUNT in 
yes)
    begin_script MOUNT "mounting other partitions ..."

    # find data-partition created with opt_hdinstall typ a or b
    grep "$hd_data" /proc/partitions >/dev/nul
    if [ "$?" = "0" -a "$hd_data" != "" ]
    then
        colecho "mounting data-partition..." gn
        
        echo "/dev/$hd_data /data ext3 defaults 0 1" >> /etc/fstab
        
        if [ -f /sbin/e2fsck ]
        then
            e2fsck -p "/dev/$hd_data"     
        fi
        
        mkdir /data
        mount /data
        if [ "$?" != "0" ]
        then
            colecho "ERROR: can't mount data-partition" br x br
            sleep 10        
        fi
    fi
    
    # find and mount first cdrom-drive
    if [ -f /proc/sys/dev/cdrom/info ]
    then
        colecho "mounting cd-rom..." gn

        cd_drives=`cat /proc/sys/dev/cdrom/info | grep "drive name:"`
        set $cd_drives
        drive=$3
        # select always the first scsi-drive
        if [ -n "`echo "$drive" | grep "sr"`" ]
        then
            drive=scd0
        fi
        echo "/dev/$drive /cdrom iso9660 ro 0 0" >> /etc/fstab
        
        mkdir /cdrom
        if [ "$drive" = "scd0" -o "`cat /proc/ide/$drive/capacity`" != "0" ]
        then
            mount /cdrom
            if [ "$?" != "0" ]
            then
                colecho "ERROR: can't mount cd-rom /dev/$drive" br x br
                sleep 10
            fi
        else
            echo "no media present"
        fi
    fi

    end_script
;;    
esac
