diff options
author | PÁLI Gábor János <pali.gabor@gmail.com> | 2022-07-21 01:29:16 +0200 |
---|---|---|
committer | PÁLI Gábor János <pali.gabor@gmail.com> | 2022-07-21 01:29:16 +0200 |
commit | 74a203337343b8e7615f335146592536aa577bd5 (patch) | |
tree | 7ab9c558ed28013def39df4158057f9becf352da /aports/busybox/persistent-storage | |
parent | f8fd8cdb1a0e545272917fe1dc1f9544cf74e383 (diff) | |
download | freebsd-wifibox-alpine-74a203337343b8e7615f335146592536aa577bd5.zip |
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
Diffstat (limited to 'aports/busybox/persistent-storage')
-rw-r--r-- | aports/busybox/persistent-storage | 27 |
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 + |