added usb-storage hotpluging
[openwrt.git] / package / base-files / files / sbin / usb-storage
1 #!/bin/sh
2
3 # Copyright (C) 2006 OpenWrt.org
4
5 logger "usb device is mass storage"
6 i=0
7 while [ $i -le 10 ]; do
8 logger "waiting on usb drive $i ..."
9 i=$(($i+1))
10 cd /sys${DEVPATH}
11 for blk in `find host* -type d`; do
12 cd /sys/${DEVPATH}/${blk}
13 BLK=$(find block* -type l 2> /dev/null)
14 [ -n "${BLK}" ] && {
15 cd /sys${DEVPATH}/${blk}/${BLK}
16 ls /dev/ > /tmp/d
17 sleep 2
18 for node in `find sd* -type d | grep -v "/"`; do
19 echo "mounting /dev/${node} on /mnt/usbdrive"
20 mkdir -p /mnt/usbdrive
21 mount /dev/${node} /mnt/usbdrive
22 exit 0
23 done
24 }
25 done
26 sleep 1
27 done
28
This page took 0.074552 seconds and 5 git commands to generate.