add a variable to keep track of the list of sections when loading uci config files...
[openwrt.git] / package / base-files / files / etc / hotplug.d / usb / 01-ln
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 case "$ACTION" in
5 add)
6 [ -f /sys/${DEVPATH}/idVendor -a "$(cat /sys/${DEVPATH}/idVendor)" != "0000" ] && {
7 cd /sys/${DEVPATH}
8
9 NUM=${DEVPATH##*/}
10 HOST=$(find ${NUM}:*/host* -type d)
11 HOST=${HOST##*/host}
12
13 echo -ne "waiting for disk"
14
15 while [ ! -d "/dev/scsi/host${HOST}/bus0/target0/lun0" ]; do {
16 echo -ne "."
17 sleep 1;
18 [ "$((++time))" -gt 10 ] && break
19 }; done
20 echo
21
22 cd /sys/bus/scsi/devices/${HOST}\:0\:0\:0
23 for BLOCK in block:* ; do {
24 cd ${BLOCK}
25 BLOCK=${BLOCK##block\:}
26 ln -sf /dev/scsi/host${HOST}/bus0/target0/lun0/disc /dev/${BLOCK}
27 for DEV in ${BLOCK}*; do {
28 ln -sf /dev/scsi/host${HOST}/bus0/target0/lun0/part${DEV##$BLOCK} /dev/$DEV
29 }; done
30 }; done
31 } 2>&1 | logger
32 ;;
33 esac
This page took 0.046634 seconds and 5 git commands to generate.