-# we cannot use /usr/bin/find here
-find_d () {
- where=$1
- what=$2
- found=""
- for f in $where/*; do
- if [ -d "$f" -a ! -L "$f" ]; then
- if [ "$f" != "${f%%$what}" ];then
- # make sure we are at the path end
- # we have no dirname and basename
- rest="${f#*$what}"
- [ "${rest##*/}" = "$rest" ] && found="$found $f"
- fi
- found="$found $(find_d $f $what)"
- fi
- done
- echo "$found"
-}
-
-# we cannot use /usr/bin/find here
-find_f () {
- where=$1
- what=$2
- found=""
- for f in $where/*; do
- if [ -d "$f" -a ! -L "$f" ]; then
- found="$found $(find_f $f $what)"
- elif [ -e "$f" ]; then
- [ "$where/" = "${f%$what}" ] && found="$found $f"
- fi
- done
- [ -n "$found" ] && echo "$found"
-}
-
-# call hotplug with the scsi devices
-scsi_replay () {
- HOTPLUG="/sbin/udevsend"
-
- scsi_hosts=$(find_d /sys/devices host\*)
- SEQNUM=1
-
- for host in $scsi_hosts; do
- [ -d $host ] || continue
- devs=$(find_f $host type)
- for dev in $devs;do
- [ -f $dev ] || continue
- DEVPATH=${dev%/type}
- DEVPATH=${DEVPATH#/sys}
- /bin/env -i DEVPATH="$DEVPATH" SUBSYSTEM=scsi_device ACTION=add $HOTPLUG scsi_device
- /bin/env -i DEVPATH="$DEVPATH" ACTION=add SUBSYSTEM=scsi $HOTPLUG scsi
- done
- done
- return 0