summaryrefslogtreecommitdiff
path: root/aports/busybox/persistent-storage
diff options
context:
space:
mode:
Diffstat (limited to 'aports/busybox/persistent-storage')
-rw-r--r--aports/busybox/persistent-storage27
1 files changed, 21 insertions, 6 deletions
diff --git a/aports/busybox/persistent-storage b/aports/busybox/persistent-storage
index ea68948..4b821bc 100644
--- a/aports/busybox/persistent-storage
+++ b/aports/busybox/persistent-storage
@@ -7,10 +7,12 @@ symlink_action() {
esac
}
+: ${SYSFS:=/sys}
+
# cdrom symlink
case "$MDEV" in
sr*|xvd*)
- caps="$(cat /sys/block/$MDEV/capability 2>/dev/null)"
+ caps="$(cat $SYSFS/block/$MDEV/capability 2>/dev/null)"
if [ $(( 0x${caps:-0} & 8 )) -gt 0 ]; then
symlink_action $MDEV cdrom
fi
@@ -19,13 +21,13 @@ esac
# by-id symlinks
mkdir -p disk/by-id
-partition=$(cat /sys/class/block/$MDEV/partition 2>/dev/null)
+partition=$(cat $SYSFS/class/block/$MDEV/partition 2>/dev/null)
case "$partition" in
[0-9]*) partsuffix="-part$partition";;
esac
-wwid=$(cat /sys/class/block/$MDEV/wwid 2>/dev/null)
-: ${wwid:=$(cat /sys/class/block/$MDEV/device/wwid 2>/dev/null)}
+wwid=$(cat $SYSFS/class/block/$MDEV/wwid 2>/dev/null)
+: ${wwid:=$(cat $SYSFS/class/block/$MDEV/device/wwid 2>/dev/null)}
if [ -n "$wwid" ]; then
case "$MDEV" in
@@ -37,10 +39,10 @@ if [ -n "$wwid" ]; then
fi
serial=$(sed -E -e 's/^\s+//' -e 's/\s+$//' -e 's/ /_/g' \
- /sys/class/block/$MDEV/device/serial 2>/dev/null)
+ $SYSFS/class/block/$MDEV/device/serial 2>/dev/null)
model=$(sed -E -e 's/^\s+//' -e 's/\s+$//' -e 's/ /_/g' \
- /sys/class/block/$MDEV/device/model 2>/dev/null)
+ $SYSFS/class/block/$MDEV/device/model 2>/dev/null)
if [ -n "$serial" ] && [ -n "$model" ]; then
case "$MDEV" in
@@ -66,3 +68,16 @@ if [ -n "$PARTUUID" ]; then
symlink_action ../../$MDEV disk/by-partuuid/$PARTUUID
fi
+# backwards compatibility with /dev/usbdisk for /dev/sd*
+if [ "${MDEV#sd}" != "$MDEV" ]; then
+ sysdev=$(readlink $SYSFS/class/block/$MDEV)
+ case "$sysdev" in
+ *usb[0-9]*)
+ # require vfat for devices without partition
+ if ! [ -e $SYSFS/block/$MDEV ] || [ TYPE="vfat" ]; then
+ symlink_action $MDEV usbdisk
+ fi
+ ;;
+ esac
+fi
+