r121 - mdadm/trunk/debian/initramfs
madduck at users.alioth.debian.org
madduck at users.alioth.debian.org
Sun Aug 20 22:13:19 UTC 2006
Author: madduck
Date: 2006-08-20 22:13:17 +0000 (Sun, 20 Aug 2006)
New Revision: 121
Modified:
mdadm/trunk/debian/initramfs/hook
mdadm/trunk/debian/initramfs/script.local-top
Log:
more safety
Modified: mdadm/trunk/debian/initramfs/hook
===================================================================
--- mdadm/trunk/debian/initramfs/hook 2006-08-20 21:47:38 UTC (rev 120)
+++ mdadm/trunk/debian/initramfs/hook 2006-08-20 22:13:17 UTC (rev 121)
@@ -43,13 +43,9 @@
[ -r /usr/share/initramfs-tools/hook-functions ] || exit 0
. /usr/share/initramfs-tools/hook-functions
-DEBIANCONFIG=/etc/default/mdadm
CONFIG=/etc/mdadm/mdadm.conf
ALTCONFIG=/etc/mdadm.conf
-INITRDSTART=all
-[ -s $DEBIANCONFIG ] && . $DEBIANCONFIG
-
[ ! -f $CONFIG ] && [ -f $ALTCONFIG ] && CONFIG=$ALTCONFIG
if [ -f $CONFIG ]; then
if [ -e /var/lib/mdadm/CONF-UNCHECKED ]; then
@@ -105,13 +101,19 @@
for i in $@; do echo "$i"; done | sort -u
}
+DEBIANCONFIG=/etc/default/mdadm
+INITRDSTART=all
+[ -s $DEBIANCONFIG ] && . $DEBIANCONFIG
+
+# save the homehost for now, even if we don't use it yet
+homehost="$(sed -ne 's,^[[:space:]]*HOMEHOST[[:space:]]*,,p' $CONFIG)"
+if [ -z "$homehost" ] || [ "$homehost" = '<system>' ]; then
+ homehost="$(hostname)"
+fi
+echo "MD_HOMEHOST='$homehost'" > $DESTDIR/conf/md.conf
+
+[ -z "$INITRDSTART" ] && INITRDSTART=none
if [ "$INITRDSTART" != none ] && [ -n "$devpairs" ]; then
- # save the homehost for now, even if we don't use it yet
- homehost="$(sed -ne 's,^[[:space:]]*HOMEHOST[[:space:]]*,,p' $CONFIG)"
- if [ -z "$homehost" ] || [ "$homehost" = '<system>' ]; then
- homehost="$(hostname)"
- fi
- echo "MD_HOMEHOST='$homehost'" > $DESTDIR/conf/md.conf
echo "MD_DEVPAIRS='${devpairs% }'" >> $DESTDIR/conf/md.conf
devs=''; levels=''
@@ -127,6 +129,19 @@
esac
done
+ for i in $INITRDSTART; do
+ case "$devs" in
+ all|*${i}*) continue;::
+ *) :;;
+ esac
+
+ echo "W: mdadm: I am supposed to start $i from the initial ramdisk," >&2
+ echo "W: mdadm: yet I cannot find the array in the configuration file." >&2
+ echo "W: mdadm: I am thus reverting to starting all arrays." >&2
+ INITRDSTART=all
+ break
+ done
+
echo "MD_LEVELS='$levels'" >> $DESTDIR/conf/md.conf
if [ "$INITRDSTART" = all ]; then
echo "MD_DEVS=all" >> $DESTDIR/conf/md.conf
@@ -153,6 +168,7 @@
fi
else
+ echo "MD_DEVS=none" >> $DESTDIR/conf/md.conf
echo "I: mdadm: no MD arrays will be started from the initial ramdisk." >&2
fi
Modified: mdadm/trunk/debian/initramfs/script.local-top
===================================================================
--- mdadm/trunk/debian/initramfs/script.local-top 2006-08-20 21:47:38 UTC (rev 120)
+++ mdadm/trunk/debian/initramfs/script.local-top 2006-08-20 22:13:17 UTC (rev 121)
@@ -46,11 +46,6 @@
MD_MODULES='linear multipath raid0 raid1 raid456 raid5 raid6 raid10'
[ -s /conf/md.conf ] && . /conf/md.conf
-CONFIG=/etc/mdadm/mdadm.conf
-# this really should not be needed, but also doesn't hurt.
-[ -e $CONFIG ] || \
- $MDADM --examine --scan --config=partitions > $CONFIG
-
verbose && log_begin_msg Loading MD modules
for module in ${MD_MODULES:-}; do
if modprobe --syslog "$module"; then
@@ -69,6 +64,11 @@
# handle /dev/md/X nodes
mkdir --parent /dev/md
+CONFIG=/etc/mdadm/mdadm.conf
+# this really should not be needed, but also doesn't hurt.
+[ -e $CONFIG ] || \
+ $MDADM --examine --scan --config=partitions > $CONFIG
+
if [ "$MD_DEVS" = all ]; then
verbose && log_begin_msg "Assembling all MD arrays"
@@ -84,7 +84,7 @@
verbose && log_end_msg
-else
+elif [ "$MD_DEVS" != none ]; then
for dev in $MD_DEVS; do
verbose && log_begin_msg "Assembling MD array $dev"
More information about the pkg-mdadm-commits
mailing list