summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install/autodetect28
1 files changed, 22 insertions, 6 deletions
diff --git a/install/autodetect b/install/autodetect
index 3fb87ce..5cc908c 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -1,6 +1,9 @@
#!/bin/bash
build() {
+ local -a md_devs
+ local dev insufficient_perms
+
MODULE_FILE=$workdir/autodetect_modules
add_if_avail() {
@@ -29,15 +32,28 @@ build() {
add_if_avail "$usrfstype"
fi
- if (( UID == 0 )) || in_array 'disk' $(groups); then
- if [[ -x $(type -P mdadm) ]]; then
- mdadm -Esv /dev/[hrsv]d* /dev/{ida,cciss,ataraid,mapper}/* |
+ # look for raid devices
+ shopt -s nullglob
+ for dev in /sys/class/block/*/md/dev-*; do
+ dev=/dev/${dev#*/dev-}
+
+ [[ -r $dev ]] || insufficient_perms=1
+
+ md_devs+=("$dev")
+ done
+ shopt -u nullglob
+
+ # scan members of raid devices if found
+ if (( ${#md_devs[*]} )); then
+ (( !QUIET )) && plain "found %d raid members to scan" "${#md_devs[*]}"
+ if (( ! insufficient_perms )); then
+ mdadm -Esv "${md_devs[@]}" |
sed -n 's/.*level=\([^ ]\+\) .*/\1/p' |
sed 's/\<raid[456]\>/raid456/g' | sort -u >>"$MODULE_FILE"
+ else
+ warning "Insufficient permission to perform autodetection for mdadm devices"
+ raid_autodetect_failed=1
fi
- else
- error "Insufficient permission to perform autodetection for mdadm devices"
- raid_autodetect_failed=1
fi
if (( !QUIET )) && [[ -s $MODULE_FILE ]]; then