#!/bin/sh # # ide 1.12 2000/06/06 21:02:09 (David Hinds) # # Initialize or shutdown a PCMCIA ATA/IDE adapter # # The first argument should be either 'start' or 'stop'. The second # argument is the base name for the device. # # The script passes an extended device address to 'ide.opts' in the # ADDRESS variable, to retrieve device-specific configuration options. # The address format is "scheme,socket,serial_no[,part]" where # "scheme" is the PCMCIA configuration scheme, "socket" is the socket # number, "serial_no" is the card's serial number if available, and # "part" is, optionally, the partition number. # # The script first calls ide.opts for the entire device. If ide.opts # returns with the PARTS variable set, then this variable contains a # list of partitions for which options should be read. # SMB_MOUNT=/home/samba/CF_Card INSTALL_DIR=Documents/Install_Files STORAGE_PID_FILE=/var/run/usbdstorage.pid STORAGE_PID="" USB_STATUS="" STORAGE_DEV="" if [ -r $STORAGE_PID_FILE ]; then STORAGE_PID=`cat $STORAGE_PID_FILE` USB_STATUS=`cat /proc/usb-storage | grep "USB status" | cut -d : -f 2` STORAGE_DEV=`cat /etc/hotplug/usbdstorage.conf` fi if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi # Get device attributes get_info $DEVICE if [ ! -b /dev/$DEVICE ] ; then mknod /dev/$DEVICE b $MAJOR 0 for minor in 1 2 3 4 5 6 7 8 ; do mknod /dev/${DEVICE}$minor b $MAJOR $minor done fi case "$ACTION" in 'suspend'|'resume'|'stop') ;; *) eval `/sbin/ide_info /dev/$DEVICE` || usage ;; esac # Load site-specific settings ADDRESS="$SCHEME,$SOCKET,$SERIAL_NO" . $0.opts case "$ACTION" in 'start') if [ $USB_STATUS = USB_CONNECT ]; then if [ $STORAGE_DEV = /dev/${DEVICE}1 ]; then if [ $STORAGE_PID ]; then kill -HUP "$STORAGE_PID" fi exit 0 fi fi add_parts "$ADDRESS" "$PARTS" || exit 1 if [ -d $SMB_MOUNT ] ; then rm -rf $SMB_MOUNT fi ln -s $MOUNTPT $SMB_MOUNT mkdir -p $MOUNTPT/$INSTALL_DIR if [ $STORAGE_DEV = /dev/${DEVICE}1 ]; then if [ $STORAGE_PID ]; then kill -HUP "$STORAGE_PID" fi fi ;; 'check') is_true $NO_CHECK && exit 0 if [ -b /dev/$DEVICE ] ; then do_fuser -s -m /dev/${DEVICE}* && exit 1 else do_fuser -s /dev/${DEVICE}* && exit 1 fi ;; 'stop') if [ $STORAGE_DEV = /dev/${DEVICE}1 ]; then if [ $STORAGE_PID ]; then kill -HUP "$STORAGE_PID" fi fi rm_parts "$ADDRESS" "$PARTS" || exit 1 rm $SMB_MOUNT ;; 'cksum') chk_parts "$NEW_SCHEME,$SOCKET,$SERIAL_NO" || exit 1 ;; 'suspend'|'resume') ;; *) usage ;; esac exit 0