2007-06-21 01:05:15 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-11-04 17:12:08 +02:00
|
|
|
# Copyright (C) 2007 OpenWrt.org
|
2007-06-21 01:05:15 +03:00
|
|
|
|
|
|
|
logger "usb device is mass storage"
|
2007-11-04 17:12:08 +02:00
|
|
|
i=0
|
2007-06-21 01:05:15 +03:00
|
|
|
while [ $i -le 10 ]; do
|
2007-11-04 17:12:08 +02:00
|
|
|
logger "waiting on usb drive $i ..."
|
2007-06-21 01:05:15 +03:00
|
|
|
i=$(($i+1))
|
|
|
|
cd /sys${DEVPATH}
|
2007-11-04 17:12:08 +02:00
|
|
|
for blk in `find host* -type d 2>/dev/null`; do
|
2007-06-21 01:05:15 +03:00
|
|
|
cd /sys/${DEVPATH}/${blk}
|
2007-11-04 17:12:08 +02:00
|
|
|
BLK=$(find block* -type l 2>/dev/null)
|
2007-06-21 01:05:15 +03:00
|
|
|
[ -n "${BLK}" ] && {
|
|
|
|
cd /sys${DEVPATH}/${blk}/${BLK}
|
|
|
|
ls /dev/ > /tmp/d
|
|
|
|
sleep 2
|
2007-11-04 17:12:08 +02:00
|
|
|
for node in `find sd* -type d 2>/dev/null| grep -v "/"`; do
|
2007-06-21 01:05:15 +03:00
|
|
|
echo "mounting /dev/${node} on /mnt/usbdrive"
|
|
|
|
mkdir -p /mnt/usbdrive
|
|
|
|
mount /dev/${node} /mnt/usbdrive
|
|
|
|
exit 0
|
|
|
|
done
|
|
|
|
}
|
|
|
|
done
|
|
|
|
sleep 1
|
2007-11-04 17:12:08 +02:00
|
|
|
done
|
|
|
|
|