summaryrefslogtreecommitdiff
path: root/debian/mdadm.config
diff options
context:
space:
mode:
authormadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-08-02 13:34:18 +0000
committermadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-08-02 13:34:18 +0000
commitab7c1d7ccaa360ffd620bc0fe1a016d327d62578 (patch)
tree457f4d4dd777fbc16a7dc4809f57180ad41b7f23 /debian/mdadm.config
parente6c18702f7fe8596af15a478267aecd827fce205 (diff)
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).
Diffstat (limited to 'debian/mdadm.config')
-rw-r--r--debian/mdadm.config52
1 files changed, 30 insertions, 22 deletions
diff --git a/debian/mdadm.config b/debian/mdadm.config
index a7e33dab..0579d6da 100644
--- a/debian/mdadm.config
+++ b/debian/mdadm.config
@@ -50,10 +50,12 @@ fi
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 @@ while true; do
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