From 74a203337343b8e7615f335146592536aa577bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=81LI=20G=C3=A1bor=20J=C3=A1nos?= Date: Thu, 21 Jul 2022 01:29:16 +0200 Subject: busybox: import changes from upstream (without tests) References: - https://git.alpinelinux.org/aports/commit/main/busybox?h=3.16-stable&id=e58f0e341603e9facc1e675722367174b45e0d0c - https://git.alpinelinux.org/aports/commit/main/busybox?h=3.16-stable&id=19218bdfa3f0798fad9a878789336099e038151f - https://git.alpinelinux.org/aports/commit/main/busybox-initscripts?h=3.16-stable&id=5df3afdec03f10e706c10fd2653a51aa39eae601 - https://git.alpinelinux.org/aports/commit/main/busybox-initscripts?h=3.16-stable&id=0ce8430810dd7ae8917b4e17cb67d8ed6b4cd41d --- aports/busybox/persistent-storage | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'aports/busybox/persistent-storage') 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 + -- cgit v1.2.3