#!/bin/bash # # SCSI-specific hotplug policy agent. # # This should handle 2.2.18+ (?) and 2.4.* SCSI hotplugging, # with a consistent framework for adding device and driver # specific treatments. # # Kernel SCSI hotplug params include: # # ACTION=%s [add or remove] # SCSI_HOST=%u # SCSI_BUS=%u # SCSI_TARGET=%u # SCSI_LUN=%u # SCSI_VENDOR=%s # SCSI_MODEL=%s # SCSI_REV=%s # SCSI_TYPE=%d # SCSI_REMOVABLE=%d # SCSI_EMULATED=%d # SCSI_EVENT_ATTACHED=%lu # [ SCSI_EVENT_DETACHED=%lu when ACTION=remove] # # If devfs is being used, a newly added SCSI device will be found in # the directory: # /dev/scsi/host$SCSI_HOST/bus$SCSI_BUS/target$SCSI_TARGET/lun$SCSI_LUN # # # HISTORY: # # 8-Mar-2001 First cut (dpg) # # $Id: # cd /etc/hotplug . hotplug.functions # DEBUG=yes export DEBUG case $ACTION in add) case $SCSI_TYPE in 0 | 7) # TYPE_DISK or TYPE_MOD $MODPROBE sd_mod > /dev/null 2>&1 # mesg scsi.agent loading sd_mod ;; 5 | 4) # TYPE_ROM or TYPE_WORM $MODPROBE sr_mod > /dev/null 2>&1 # should now check /proc/sys/dev/cdrom/info for "1" # in CD-R or CD-RW row. If so load sg # mesg scsi.agent loading sr_mod ;; 1) # TYPE_TAPE if [ "$SCSI_VENDOR" = "OnStream" ]; then $MODPROBE osst > /dev/null 2>&1 # mesg scsi.agent loading osst else $MODPROBE st > /dev/null 2>&1 # mesg scsi.agent loading st fi ;; *) # something else (scanner) so load sg $MODPROBE sg > /dev/null 2>&1 # mesg scsi.agent loading sg ;; esac ;; remove) # could try rmmod here but that might be pre-emptive ;; *) mesg SCSI $ACTION event not supported exit 1 esac