r166 - mdadm/trunk/debian

madduck at users.alioth.debian.org madduck at users.alioth.debian.org
Wed Sep 13 11:21:20 UTC 2006


Author: madduck
Date: 2006-09-13 11:21:20 +0000 (Wed, 13 Sep 2006)
New Revision: 166

Modified:
   mdadm/trunk/debian/changelog
   mdadm/trunk/debian/mdadm.config
Log:
  * If mdadm is being configured in a chroot, it now defaults to starting all
    arrays from the initial ramdisk, rather than trying to figure out the root
    MD array (we're using /proc information, so it would be the one of the host, not the one of the chroot) (closes: #386468).

Modified: mdadm/trunk/debian/changelog
===================================================================
--- mdadm/trunk/debian/changelog	2006-09-13 11:15:15 UTC (rev 165)
+++ mdadm/trunk/debian/changelog	2006-09-13 11:21:20 UTC (rev 166)
@@ -14,6 +14,10 @@
   * Added bootloader/cmdline info to bugscript so that future bug reports via
     bug/reportbug include information on how the system is booted with respect
     to RAID (the root partition).
+  * If mdadm is being configured in a chroot, it now defaults to starting all
+    arrays from the initial ramdisk, rather than trying to figure out the root
+    MD array (we're using /proc information, so it would be the one of the
+    host, not the one of the chroot) (closes: #386468).
   * Added LSB headers to init scripts.
   * Reworked the documentation with respect to the use of "MD" and "RAID", and
     added a FAQ entry on the meaning of "MD". Thanks to Frans Pop for his

Modified: mdadm/trunk/debian/mdadm.config
===================================================================
--- mdadm/trunk/debian/mdadm.config	2006-09-13 11:15:15 UTC (rev 165)
+++ mdadm/trunk/debian/mdadm.config	2006-09-13 11:21:20 UTC (rev 166)
@@ -50,19 +50,31 @@
   [ -n "$MAILADDR" ] && db_set mdadm/mail_to "$MAILADDR"
 fi
 
-db_fget mdadm/initrdstart seen
-if [ -z "$INITRDSTART" ] || [ "$RET $INITRDSTART" = "false all" ]; then
+chrooted() {
+  test ! -r /proc/1/root
+}
+
+get_root_raiddev() {
+  local rootraiddev;
   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
-    # remove partition from partitionable array
-    INITRDSTART="${rootraiddev%p[0-9]*}"
+    return 1
   fi
-fi
+  echo ${rootraiddev%p[0-9]*}
+  return 0
+}
 
+get_initrdstart() {
+  db_fget mdadm/initrdstart seen
+  if chrooted || [ "$RET $INITRDSTART" = "false all" ]; then
+    echo all
+    return 1
+  fi
+
+  get_root_raiddev || echo all
+}
+
+[ -z "$INITRDSTART" ] && INITRDSTART="$(get_initrdstart)"
 [ -n "$INITRDSTART" ] && db_set mdadm/initrdstart "$INITRDSTART"
 
 db_capb escape




More information about the pkg-mdadm-commits mailing list