summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-03-30 06:20:36 +0200
committerDave Reisner <dreisner@archlinux.org>2012-04-02 00:29:55 +0200
commit20509ade3d025fe76bcdc036dfd49aa44f63d470 (patch)
treecc6d690ef6b8e5a2f5951029898ded193119ed34 /install
parent954f8c363dbfe2472c9eeafa3aa1ff5d9f2af8ca (diff)
downloadmkinitcpio-20509ade3d025fe76bcdc036dfd49aa44f63d470.tar.gz
mkinitcpio-20509ade3d025fe76bcdc036dfd49aa44f63d470.tar.xz
autodetect: simplify mdadm autodetection
Everything we need to know about the devices is already in sysfs attributes for the md devices. Read any found nodes for raid levels and sort them into our whitelist. This removes the need for root in order to "scan" arrays. More code churn on top of d11ba00. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'install')
-rw-r--r--install/autodetect28
1 files changed, 5 insertions, 23 deletions
diff --git a/install/autodetect b/install/autodetect
index 47c8c23..b6ec28a 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -2,7 +2,6 @@
build() {
local -a md_devs
- local dev insufficient_perms
MODULE_FILE=$workdir/autodetect_modules
@@ -38,28 +37,11 @@ build() {
add_if_avail "$usrfstype"
fi
- # 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
+ # scan for md raid devices
+ md_devs=(/sys/class/block/md*/md/level)
+ if [[ -e $md_devs ]]; then
+ (( !QUIET )) && plain "found %d mdadm arrays to scan" "${#md_devs[*]}"
+ sort -u "${md_devs[@]}" >>"$MODULE_FILE"
fi
if (( !QUIET )) && [[ -s $MODULE_FILE ]]; then