diff options
author | madduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464> | 2006-08-20 22:13:17 +0000 |
---|---|---|
committer | madduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464> | 2006-08-20 22:13:17 +0000 |
commit | 958d13b52a1288aab05a91c58191745b0b084d36 (patch) | |
tree | 88325058b5453dbf3642bcc076a91508b28a9b2b /debian/initramfs | |
parent | 091b7aaab735b641c03f9b4a8a56a6dd377caa7d (diff) |
more safety
Diffstat (limited to 'debian/initramfs')
-rw-r--r-- | debian/initramfs/hook | 36 | ||||
-rw-r--r-- | debian/initramfs/script.local-top | 12 |
2 files changed, 32 insertions, 16 deletions
diff --git a/debian/initramfs/hook b/debian/initramfs/hook index a7af4c35..e9c0f6f3 100644 --- a/debian/initramfs/hook +++ b/debian/initramfs/hook @@ -43,13 +43,9 @@ MDADM=$(command -v mdadm 2>/dev/null) || : [ -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 @@ uniquify() 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 @@ if [ "$INITRDSTART" != none ] && [ -n "$devpairs" ]; then 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 @@ if [ "$INITRDSTART" != none ] && [ -n "$devpairs" ]; then 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 diff --git a/debian/initramfs/script.local-top b/debian/initramfs/script.local-top index 8146c6d7..eecbed6a 100644 --- a/debian/initramfs/script.local-top +++ b/debian/initramfs/script.local-top @@ -46,11 +46,6 @@ MD_DEVS=all 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 @@ fi # 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 @@ if [ "$MD_DEVS" = all ]; then verbose && log_end_msg -else +elif [ "$MD_DEVS" != none ]; then for dev in $MD_DEVS; do verbose && log_begin_msg "Assembling MD array $dev" |