diff options
author | mbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-08-26 01:04:43 +0000 |
---|---|---|
committer | mbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-08-26 01:04:43 +0000 |
commit | 85b201f54538e4198183126a9f00130e2fc01df0 (patch) | |
tree | 8c2f29b2a5290c423d69b096ff2608c378ab3412 /package/base-files/default/etc/hotplug.d/usb/01-ln | |
parent | 3f494f8d220f2b1a40a6749e814b46eca48792ac (diff) |
clean up hotplug mounting scripts
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4673 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/default/etc/hotplug.d/usb/01-ln')
-rwxr-xr-x | package/base-files/default/etc/hotplug.d/usb/01-ln | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/package/base-files/default/etc/hotplug.d/usb/01-ln b/package/base-files/default/etc/hotplug.d/usb/01-ln new file mode 100755 index 000000000..f9eda0298 --- /dev/null +++ b/package/base-files/default/etc/hotplug.d/usb/01-ln @@ -0,0 +1,33 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +case "$ACTION" in +add) + [ -f /sys/${DEVPATH}/idVendor -a "$(cat /sys/${DEVPATH}/idVendor)" -ne "0000" ] && { + cd /sys/${DEVPATH} + + NUM=${DEVPATH##*/} + HOST=$(find ${NUM}:*/host* -type d) + HOST=${HOST##*/host} + + echo -ne "waiting for disk" + + while [ ! -d "/dev/scsi/host${HOST}/bus0/target0/lun0" ]; do { + echo -ne "." + sleep 1; + time=$((time+1)); [ $time -gt 10 ] && break + }; done + echo + + cd /sys/bus/scsi/devices/${HOST}\:0\:0\:0 + for BLOCK in block:* ; do { + cd ${BLOCK} + BLOCK=${BLOCK##block\:} + ln -sf /dev/scsi/host${HOST}/bus0/target0/lun0/disc /dev/${BLOCK} + for DEV in ${BLOCK}*; do { + ln -sf /dev/scsi/host${HOST}/bus0/target0/lun0/part${DEV##$BLOCK} /dev/$DEV + }; done + }; done + } 2>&1 | logger + ;; +esac |