summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog4
-rw-r--r--debian/mdadm.config30
2 files changed, 25 insertions, 9 deletions
diff --git a/debian/changelog b/debian/changelog
index ed17a767..6802f76d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,10 @@ mdadm (2.5.3.git200608202239-3) unstable; urgency=medium
* 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
diff --git a/debian/mdadm.config b/debian/mdadm.config
index 6a59ef1d..9fdde4dc 100644
--- a/debian/mdadm.config
+++ b/debian/mdadm.config
@@ -50,19 +50,31 @@ if [ -s $DEBIANCONFIG ] ; then
[ -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