small tweaks to the usb disk hotplug scripts
[openwrt/svn-archive/archive.git] / package / base-files / files / etc / hotplug.d / block / 01-mount
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 DEV=${DEVPATH##*/}
5 {
6 case "$ACTION" in
7 add)
8 echo -ne "waiting for $DEV"
9 while [ ! -b /dev/$DEV ]; do {
10 echo -ne "."
11 sleep 1
12 [ $((++time)) -gt 10 ] && break
13 }; done
14 echo
15
16 [ ${DEV%%[0-9]} != ${DEV} ] && {
17 mkdir -p /tmp/$DEV
18 mount /dev/$DEV /tmp/$DEV -t auto -o sync
19 }
20 ;;
21 remove)
22 umount /tmp/$DEV && rm -f /dev/$DEV /tmp/$DEV
23 ;;
24 esac
25 } 2>&1 | logger