#!/bin/sh
#
# cdrom 1.11 1998/10/08 19:44:18 (David Hinds)
#
# Initialize or shutdown a PCMCIA CD-ROM device
#
# The first argument should be either 'start' or 'stop'.  The second
# argument is the name for the device.
#
# The script passes an extended device address to 'cdrom.opts' in the 
# ADDRESS variable, to retrieve device-specific configuration options.
# The address format is "scheme,socket" where "scheme" is the current
# PCMCIA device configuration scheme, and "socket" is the socket
# number.
#

if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi

# Get device attributes
get_info $DEVICE

# Load site-specific settings
ADDRESS="$SCHEME,$SOCKET"
. $0.opts

case "$ACTION" in

'start')
    add_blkdev /dev/$DEVICE || exit 1
    ;;

'check')
    fuser -s -m /dev/$DEVICE && exit 1
    ;;

'stop')
    rm_blkdev /dev/$DEVICE || exit 1
    ;;

'cksum')
    chk_simple "$3,$SOCKET" || exit 1
    ;;
    
'suspend'|'resume')
    ;;

*)
    usage
    ;;

esac

exit 0
