martin f. krafft: refactor messages from initramfs hook
Martin F. Krafft
madduck at alioth.debian.org
Fri Jan 29 06:19:56 UTC 2010
Module: mdadm
Branch: incremental
Commit: 4f1001b4e2de7780f05b4f90142aa37064fe2b4e
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=4f1001b4e2de7780f05b4f90142aa37064fe2b4e
Author: martin f. krafft <madduck at debian.org>
Date: Fri Jan 29 17:50:49 2010 +1300
refactor messages from initramfs hook
Signed-off-by: martin f. krafft <madduck at debian.org>
---
debian/initramfs/hook | 49 ++++++++++++++++++++++++++++++++-----------------
1 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/debian/initramfs/hook b/debian/initramfs/hook
index 432da8b..0686e63 100644
--- a/debian/initramfs/hook
+++ b/debian/initramfs/hook
@@ -112,6 +112,26 @@ install_config()
sed -e :a -re '$!N;s/\n[[:space:]]+/ /;ta' -ne '/^(ARRAY|DEVICE|HOMEHOST)/P;D' $1 > $2
}
+warn_upgrade()
+{
+ warn 'please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz .'
+ warn 'your system MAY CURRENTLY BE UNBOOTABLE!'
+}
+
+warn_emergency()
+{
+ warn 'falling back to emergency procedure in initramfs,'
+ warn 'which may well FAIL TO BOOT YOUR SYSTEM!'
+}
+
+change_notice()
+{
+ # only output this on Debian systems
+ if [ -s /etc/default/mdadm ]; then
+ info "use 'dpkg-reconfigure ${1:+--priority=$1 }mdadm' to change this."
+ fi
+}
+
if [ ! -f $CONFIG ]; then
# there is no configuration file, so let's create one
@@ -122,7 +142,7 @@ if [ ! -f $CONFIG ]; then
else
# we failed to auto-generate, so let the emergency procedure take over
warn "failed to auto-generate the mdadm.conf file."
- warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ."
+ warn_upgrade
fi
else
@@ -133,7 +153,7 @@ else
# work. We thus better create one and start all arrays to be sure.
warn "unchecked configuration file: $CONFIG"
- warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ."
+ warn_upgrade
use_temp=1
elif ! grep -q '^ARRAY' $CONFIG; then
@@ -163,6 +183,7 @@ else
warn "failed to auto-generate temporary mdadm.conf file."
if grep -q '^ARRAY' $CONFIG; then
warn "using the unchecked file and hoping for the best..."
+ warn "your system MAY CURRENTLY BE UNBOOTABLE!"
install_config $CONFIG $DESTMDADMCONF
fi
fi
@@ -174,12 +195,12 @@ fi
# if at this point, $DESTMDADMCONF does not exist or it does not contain any
# ARRAY statements, we must let the initramfs handle stuff.
if [ ! -f $DESTMDADMCONF ]; then
- warn no configuration file available.
- warn falling back to emergency procedure in initramfs.
+ warn 'no configuration file available.'
+ warn_emergency
exit 0
elif ! grep -q '^ARRAY' $DESTMDADMCONF; then
- warn no arrays defined in configuration file.
- warn falling back to emergency procedure in initramfs.
+ warn 'no arrays defined in configuration file.'
+ warn_emergency
exit 0
else
# obtain dev:level pairs from config file, honouring multiline entries
@@ -197,7 +218,7 @@ else
err "invalid level specified in ARRAY statement in $CONFIG:"
err " $line"
err "levels should be either raid*, linear, or multipath."
- warn "falling back to emergency procedure in initramfs."
+ warn_emergency
exit 0
;;
(*) :;;
@@ -230,13 +251,9 @@ else
fi
if is_true "$INCREMENTAL"; then
- info MD arrays are being incrementally assembled,
- info thus not trying to figure out which arrays should be
- info started at boot.
-
- # only output this on Debian systems
- [ -s /etc/default/mdadm ] && \
- info 'use `dpkg-reconfigure --priority=medium mdadm` to change this.'
+ info 'MD arrays are being incrementally assembled, thus not trying to'
+ info 'figure out which arrays should be started at boot.'
+ change_notice medium
exit 0
fi
@@ -324,8 +341,6 @@ else
info "no MD arrays will be started from the initial ramdisk."
fi
-# only output this on Debian systems
-[ -s /etc/default/mdadm ] && \
- info 'use `dpkg-reconfigure --priority=low mdadm` to change this.'
+change_notice low
exit 0
More information about the pkg-mdadm-commits
mailing list