diff options
author | Simon Rettberg | 2022-10-19 17:10:22 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-10-19 17:10:22 +0200 |
commit | 8af024aa763b6e838a869bbee3a1a732f1be65c5 (patch) | |
tree | 849f5e11ad5686d07348a61df464853a91a4a9c2 /modules | |
parent | [dev] Fix missing instance where we need to check for 0f (diff) | |
download | slx-tools-8af024aa763b6e838a869bbee3a1a732f1be65c5.tar.gz slx-tools-8af024aa763b6e838a869bbee3a1a732f1be65c5.tar.xz slx-tools-8af024aa763b6e838a869bbee3a1a732f1be65c5.zip |
[dev] Support >= 10 partitions
Diffstat (limited to 'modules')
-rw-r--r-- | modules/dev.inc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/dev.inc b/modules/dev.inc index 0b27eff..13b042f 100644 --- a/modules/dev.inc +++ b/modules/dev.inc @@ -55,7 +55,7 @@ dev_find_partitions() { # This only makes sense if called within this script, or if slx-tools # was sourced, otherwise the variables will be inaccessible. dev_get_type() { - local part dev partn devn pstart + local part dev partn devlist devn pstart dev= mbrid= uuid= @@ -64,8 +64,10 @@ dev_get_type() { [ -b "$1" ] || return 1 part="$( readlink -f "$1" )" partn="${part##*/}" - for devn in "${partn%p?}" "${partn%?}"; do - if [ "$dev" != "$part" ] && [ -f "/sys/block/${devn}/${partn}/uevent" ]; then + devlist="$( printf "%s" "$partn" | sed -r 's/[0-9]+$//' )" + [ "$partn" = "$devlist" ] && return 1 + for devn in "${devlist}" "${devlist%p}"; do + if [ -f "/sys/block/${devn}/${partn}/uevent" ]; then dev="/dev/${devn}" break fi |