r59 - mdadm/trunk/debian

madduck at users.alioth.debian.org madduck at users.alioth.debian.org
Wed Aug 2 13:34:23 UTC 2006


Author: madduck
Date: 2006-08-02 13:34:18 +0000 (Wed, 02 Aug 2006)
New Revision: 59

Modified:
   mdadm/trunk/debian/changelog
   mdadm/trunk/debian/mdadm.config
Log:
  The autodetection code now doesn't care about the actual name of the array
  device, but instead only insists that it exists, is a block device, and
  recognised as an array by mdadm (mdadm --detail).

Modified: mdadm/trunk/debian/changelog
===================================================================
--- mdadm/trunk/debian/changelog	2006-08-02 13:25:06 UTC (rev 58)
+++ mdadm/trunk/debian/changelog	2006-08-02 13:34:18 UTC (rev 59)
@@ -8,11 +8,14 @@
     RAID autodetection code (closes: #381007), which was introduced as part of
     the fix for #380596 in the 2.5.2-9 upload. The bug is RC, but it only
     applies to unstable right now, so I am not pumping up the urgency.
+    The autodetection code now doesn't care about the actual name of the array
+    device, but instead only insists that it exists, is a block device, and
+    recognised as an array by mdadm (mdadm --detail).
   * checkarray: correctly recognise when the kernel is too old for parity
     checks, or when there are no redundant arrays present.
   * mkconf: now also outputs MAILADDR.
 
- -- martin f. krafft <madduck at debian.org>  Tue,  1 Aug 2006 20:23:09 +0100
+ -- martin f. krafft <madduck at debian.org>  Wed,  2 Aug 2006 12:01:25 +0100
 
 mdadm (2.5.2-9) unstable; urgency=low
 

Modified: mdadm/trunk/debian/mdadm.config
===================================================================
--- mdadm/trunk/debian/mdadm.config	2006-08-02 13:25:06 UTC (rev 58)
+++ mdadm/trunk/debian/mdadm.config	2006-08-02 13:34:18 UTC (rev 59)
@@ -50,10 +50,12 @@
 db_input high mdadm/warning || true
 db_go
 
-if [ -z "$INITRDSTART" ]; then
+db_fget mdadm/initrdstart seen || true
+if [ -z "$INITRDSTART" ] || [ "$RET $INITRDSTART" = "false all" ]; then
   ROOTRAIDDEV="$(df / | sed -rne 's,^(/dev/[^[:space:]]+).*,\1,p')"
   if ! mdadm --detail $ROOTRAIDDEV >/dev/null 2>&1; then
     # you are using some funky setup. Let's be save...
+    # (could also happen during preconfigure, when no mdadm present)
     INITRDSTART=all
   else
     INITRDSTART="$ROOTRAIDDEV"
@@ -67,42 +69,48 @@
   db_go
 
   db_get mdadm/initrdstart
-  INITRDSTART=$RET
+  INITRDSTART="$(echo $RET | tr , ' ')"
 
   case "$INITRDSTART" in
     ''|none) INITRDSTART=none; break;;
     all) break;;
 
-    /dev/md*|md*)
+    *)
       ARRAYS=''
       ERROR=0
       for i in $INITRDSTART; do
 
-        # just in case people use commas between devices
-        i="${i%,}"
-
         # standardise by prefixing /dev/
-        case "$i" in md*) i="/dev/$i";; *) :;; esac
+        i="/dev/${i#/dev/}"
 
+        if [ ! -e "$i" ]; then
+          echo "E: device node does not exist: $i" >&2
+          ERROR=1; break
+        fi
+
+        if [ ! -b "$i" ]; then
+          echo "E: not a block device: $i" >&2
+          ERROR=1; break
+        fi
+
+        if ! mdadm --detail "$i" >/dev/null 2>&1; then
+          echo "E: not a RAID array: $i" >&2
+          ERROR=1; break
+        fi
+        
         # remove partition from name of partitionable devices
         i="${i%p[0-9]*}"
 
-        case "$i" in
-          /dev/md[0-9]*|/dev/md_d[0-9]*|/dev/md/[0-9]*|/dev/md/d[0-9]*)
-            [ -b "$i" ] && ARRAYS="${ARRAYS:+$ARRAYS }$i" && continue
-            echo "E: device does not exist: $i" >&2
-            ERROR=1; break
-            ;;
-          *)
-            echo "E: unrecognised device string: $i" >&2
-            ERROR=1; break
-            ;;
-        esac
+        # uniquely add device name
+        echo $ARRAYS | egrep -q "\b${i}\b" || ARRAYS="${ARRAYS:+$ARRAYS }$i"
       done
-      [ $ERROR -eq 0 ] && INITRDSTART="$ARRAYS" && break
+
+      if [ $ERROR -eq 0 ]; then
+        INITRDSTART="$ARRAYS"
+        # exit the while true loop
+        break
+      fi
       ;;
-
-    *) :;;
   esac
 done
 




More information about the pkg-mdadm-commits mailing list