summaryrefslogtreecommitdiff
path: root/debian/mdadm.config
diff options
context:
space:
mode:
authormadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-09-13 11:21:20 +0000
committermadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-09-13 11:21:20 +0000
commit1262406a697fd9f6ebbd24116c2052e116944084 (patch)
tree1d30adfd4c1240519a9102d7b7782b90ed63253d /debian/mdadm.config
parent9c3eb72e73ff5d978e3bf84632638b56a7aa0904 (diff)
* 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).
Diffstat (limited to 'debian/mdadm.config')
-rw-r--r--debian/mdadm.config30
1 files changed, 21 insertions, 9 deletions
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