Prevent unwanted shell expansion
[openwrt/svn-archive/archive.git] / package / base-files / files / sbin / usb-storage
1 #!/bin/sh
2 # Copyright (C) 2007 OpenWrt.org
3 logger "usb device is mass storage"
4 i=0
5 while [ $i -le 10 ]; do
6 logger "waiting on usb drive $i ..."
7 i=$(($i+1))
8 cd /sys${DEVPATH}
9 for blk in `find host* -type d 2>/dev/null`; do
10 [ -d /sys/${DEVPATH}/${blk}/block/ ] && {
11 cd
12 for disc in `find /sys/${DEVPATH}/${blk}/block -name "sd*"`; do
13 sleep 2
14 cd $disc
15 for node in `find . -name "sd*" | cut -d "/" -f2`; do
16 echo "mounting /dev/${node} on /mnt/usbdrive"
17 mkdir -p /mnt/usbdrive
18 mount /dev/${node} /mnt/usbdrive
19 i=20
20 done
21 done
22 }
23 done
24 sleep 1
25 done