]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
mdraid: fix case if rd.md.uuid is in ID_FS_UUID format
authorHarald Hoyer <harald@redhat.com>
Fri, 6 Jul 2018 07:23:00 +0000 (09:23 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 6 Jul 2018 07:25:03 +0000 (09:25 +0200)
if rd.md.uuid is in ID_FS_UUID format with dashes
e40a0234-7e52-5f10-f267-658d8ec463fa
convert it for the /dev/disk/by-id/md-uuid-${uuid} format
e40a0234:7e525f10:f267658d:8ec463fa

modules.d/90mdraid/module-setup.sh
modules.d/90mdraid/parse-md.sh

index 9015fd31bc0e74e726943dda41b196cf19e788f1..98a4ef5d522ee1a7d596e9648a3693d28e98310e 100755 (executable)
@@ -4,7 +4,7 @@
 check() {
     local _rootdev
     # No mdadm?  No mdraid support.
-    require_binaries mdadm || return 1
+    require_binaries mdadm expr || return 1
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for dev in "${!host_fs_types[@]}"; do
@@ -65,7 +65,7 @@ cmdline() {
 # called by dracut
 install() {
     local rule rule_path
-    inst_multiple cat
+    inst_multiple cat expr
     inst_multiple -o mdmon
     inst $(command -v partx) /sbin/partx
     inst $(command -v mdadm) /sbin/mdadm
index 611222286701e8b5403106250b5ba8185f46e97f..c422b24e0829be758feac5d23bbbf3e8cb3c2ef3 100755 (executable)
@@ -26,6 +26,11 @@ else
             mv "${f}.new" "$f"
         done
         for uuid in $MD_UUID; do
+            if strstr "$uuid" "-"; then
+                # convert ID_FS_UUID to MD_UUID format
+                uuid=$(str_replace "$uuid" "-" "")
+                uuid="$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
+            fi
             wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
         done
     fi