summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/dev.inc8
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