Contents of /trunk/busybox/usbdisk_link.sh
Parent Directory | Revision Log
Revision 1233 -
(show annotations)
(download)
(as text)
Fri Dec 10 22:49:20 2010 UTC (13 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 984 byte(s)
Fri Dec 10 22:49:20 2010 UTC (13 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 984 byte(s)
-tuned mdev.conf and process uevents (need initscripts with trigger_uevent support) -added mdev helpers -added rc script for syslogd, needed by dropbear
1 | #!/bin/sh |
2 | |
3 | # NOTE: since mdev -s only provide $MDEV, don't depend on any hotplug vars. |
4 | |
5 | current=$(readlink usbdisk) |
6 | |
7 | if [ "$current" = "$MDEV" ] && [ "$ACTION" = "remove" ]; then |
8 | rm -f usbdisk usba1 |
9 | fi |
10 | [ -n "$current" ] && exit |
11 | |
12 | if [ -e /sys/block/$MDEV ]; then |
13 | SYSDEV=$(readlink -f /sys/block/$MDEV/device) |
14 | # if /sys device path contains '/usb[0-9]' then we assume its usb |
15 | # also, if its an usb without partitions we require FAT |
16 | if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then |
17 | # do not create link if there is not FAT |
18 | dd if=/dev/$MDEV bs=512 count=1 2>/dev/null | strings | grep FAT >/dev/null || exit 0 |
19 | |
20 | ln -sf $MDEV usbdisk |
21 | # keep this for compat. people have it in fstab |
22 | ln -sf $MDEV usba1 |
23 | fi |
24 | |
25 | elif [ -e /sys/block/*/$MDEV ] ; then |
26 | PARENT=$(dirname /sys/block/*/$MDEV) |
27 | SYSDEV=$(readlink -f $PARENT/device) |
28 | if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then |
29 | ln -sf $MDEV usbdisk |
30 | # keep this for compat. people have it in fstab |
31 | ln -sf $MDEV usba1 |
32 | fi |
33 | fi |
34 |