r239 - in mdadm/trunk/debian: . initramfs

madduck at users.alioth.debian.org madduck at users.alioth.debian.org
Thu Oct 26 20:35:47 UTC 2006


Author: madduck
Date: 2006-10-26 20:35:47 +0000 (Thu, 26 Oct 2006)
New Revision: 239

Modified:
   mdadm/trunk/debian/changelog
   mdadm/trunk/debian/initramfs/hook
   mdadm/trunk/debian/mdadm.postinst
Log:
* Hide informational messages unless VERBOSE is set to a true value in
  /etc/default/mdadm.

Modified: mdadm/trunk/debian/changelog
===================================================================
--- mdadm/trunk/debian/changelog	2006-10-26 20:19:45 UTC (rev 238)
+++ mdadm/trunk/debian/changelog	2006-10-26 20:35:47 UTC (rev 239)
@@ -24,8 +24,10 @@
   * Added more RAID10 information to the FAQ.
   * Added filters to logcheck for regular events, even by the md driver; also
     promoted messages about non-fresh components to security events.
+  * Hide informational messages unless VERBOSE is set to a true value in
+    /etc/default/mdadm.
 
- -- martin f. krafft <madduck at debian.org>  Thu, 26 Oct 2006 22:13:16 +0200
+ -- martin f. krafft <madduck at debian.org>  Thu, 26 Oct 2006 22:35:24 +0200
 
 mdadm (2.5.4-1) unstable; urgency=low
 

Modified: mdadm/trunk/debian/initramfs/hook
===================================================================
--- mdadm/trunk/debian/initramfs/hook	2006-10-26 20:19:45 UTC (rev 238)
+++ mdadm/trunk/debian/initramfs/hook	2006-10-26 20:35:47 UTC (rev 239)
@@ -23,17 +23,46 @@
     ;;
 esac
 
+is_true()
+{
+  case "${1:-}" in
+    [Yy]es|[Yy]|1|[Tt]rue|[Tt]) return 0;;
+    *) return 1;
+  esac
+}
+
+write()
+{
+  local PREFIX; PREFIX=$1; shift
+  echo "${PREFIX}: mdadm: $@"
+}
+
+info()
+{
+  is_true ${VERBOSE:-false} && write I "$@"
+}
+
+warn()
+{
+  write W "$@"
+}
+
+err()
+{
+  write E "$@"
+}
+
 if [ -e /usr/share/initramfs-tools/hooks/md ]; then
-  echo "W: mdadm: initramfs md hook still present, stepping out of its way." >&2
-  echo "W: Please see /usr/share/doc/mdadm/README.initramfs-transition ." >&2
+  warn "initramfs md hook still present, stepping out of its way." >&2
+  warn "Please see /usr/share/doc/mdadm/README.initramfs-transition ." >&2
   exit 0
 fi
 
 if [ -e /etc/initramfs-tools/hooks/md ]; then
-  echo "W: mdadm: I found /etc/initramfs-tools/hooks/md, which may conflict" >&2
-  echo "W: with this version of mdadm. Please see /usr/share/doc/mdadm/README.mdrun" >&2
-  echo "W: and /usr/share/initramfs-tools/hooks/mdadm for reference and update" >&2
-  echo "W: (or remove) the file." >&2
+  warn "I found /etc/initramfs-tools/hooks/md, which may conflict" >&2
+  warn "with this version of mdadm. Please see /usr/share/doc/mdadm/README.mdrun" >&2
+  warn "and /usr/share/initramfs-tools/hooks/mdadm for reference and update" >&2
+  warn "(or remove) the file." >&2
   exit 0
 fi
 
@@ -88,11 +117,11 @@
   if /usr/share/mdadm/mkconf generate $CONFIG; then
     # all is well
     install_config $CONFIG $DESTMDADMCONF
-    echo "I: mdadm: auto-generated the mdadm.conf configuration file." >&2
+    info "auto-generated the mdadm.conf configuration file." >&2
   else
     # we failed to auto-generate, so let the emergency procedure take over
-    echo "W: mdadm: failed to auto-generate the mdadm.conf file." >&2
-    echo "W: mdadm: please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ." >&2
+    warn "failed to auto-generate the mdadm.conf file." >&2
+    warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ." >&2
   fi
   
 else 
@@ -102,36 +131,36 @@
     # the file comes from an old installation and hence is not guaranteed to
     # work. We thus better create one and start all arrays to be sure.
 
-    echo "W: mdadm: unchecked configuration file: $CONFIG" >&2
-    echo "W: mdadm: please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ." >&2
+    warn "unchecked configuration file: $CONFIG" >&2
+    warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ." >&2
 
     use_temp=1
   elif ! grep -q '^ARRAY' $CONFIG; then
     # the file defines no ARRAYs. We better create a temporary file to be
     # sure.
 
-    echo "W: mdadm: $CONFIG defines no arrays." >&2
+    warn "$CONFIG defines no arrays." >&2
     use_temp=1
 
   else
     # this is the ideal case
     install_config $CONFIG $DESTMDADMCONF
-    echo "I: mdadm: using configuration file: $CONFIG" >&2
+    info "using configuration file: $CONFIG" >&2
   fi
 
   if [ $use_temp -eq 1 ]; then
     tmpfile="${DESTMDADMCONF}.tmp"
     if /usr/share/mdadm/mkconf generate $tmpfile; then
       # all is well, we now have a temporary configuration file
-      echo "I: mdadm: auto-generated temporary mdadm.conf configuration file." >&2
+      info "auto-generated temporary mdadm.conf configuration file." >&2
       install_config $tmpfile $DESTMDADMCONF
     else
       # stuff's really broke, as we failed to generate a temporary file.
       # let's hope the unchecked file works, provided it contains at least one
       # ARRAY statement...
-      echo "W: mdadm: failed to auto-generate temporary mdadm.conf file." >&2
+      warn "failed to auto-generate temporary mdadm.conf file." >&2
       if grep -q '^ARRAY' $CONFIG; then
-        echo "W: mdadm: using the unchecked file and hoping for the best..." >&2
+        warn "using the unchecked file and hoping for the best..." >&2
         install_config $CONFIG $DESTMDADMCONF
       fi
     fi
@@ -143,12 +172,12 @@
 # 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
-  echo "W: mdadm: no configuration file available." >&2
-  echo "W: mdadm: falling back to emergency procedure in initramfs." >&2
+  warn "no configuration file available." >&2
+  warn "falling back to emergency procedure in initramfs." >&2
   exit 0
 elif ! grep -q '^ARRAY' $DESTMDADMCONF; then
-  echo "W: mdadm: no arrays defined in configuration file." >&2
-  echo "W: mdadm: falling back to emergency procedure in initramfs." >&2
+  warn "no arrays defined in configuration file." >&2
+  warn "falling back to emergency procedure in initramfs." >&2
   exit 0
 else
   # obtain dev:level pairs from config file, honouring multiline entries
@@ -200,9 +229,9 @@
       *) :;;
     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
+    warn "I am supposed to start $i from the initial ramdisk," >&2
+    warn "yet I cannot find the array in the configuration file." >&2
+    warn "I am thus reverting to starting all arrays." >&2
     INITRDSTART=all
     break
   done
@@ -225,20 +254,20 @@
   echo "MD_MODULES='${modules% }'" >> $DESTCONFIG
 
   if [ "$INITRDSTART" = all ]; then
-    echo "I: mdadm: will start all available MD arrays from the initial ramdisk." >&2
+    info "will start all available MD arrays from the initial ramdisk." >&2
   else
     for i in $devs; do
-      echo "I: mdadm: will start MD array $i from the initial ramdisk." >&2
+      info "will start MD array $i from the initial ramdisk." >&2
     done
   fi
 
 else
   echo "MD_DEVS=none" >> $DESTCONFIG
-  echo "I: mdadm: no MD arrays will be started from the initial ramdisk." >&2
+  info "no MD arrays will be started from the initial ramdisk." >&2
 fi
 
 # only output this on Debian systems
 [ -s /etc/default/mdadm ] && \
-  echo 'I: mdadm: use `dpkg-reconfigure --priority=low mdadm` to change this.' >&2
+  info 'use `dpkg-reconfigure --priority=low mdadm` to change this.' >&2
 
 exit 0

Modified: mdadm/trunk/debian/mdadm.postinst
===================================================================
--- mdadm/trunk/debian/mdadm.postinst	2006-10-26 20:19:45 UTC (rev 238)
+++ mdadm/trunk/debian/mdadm.postinst	2006-10-26 20:35:47 UTC (rev 239)
@@ -43,6 +43,9 @@
       cp -a /etc/mdctl/mdctl.conf /etc/mdadm/mdadm.conf
     fi
 
+    # load current settings, most of which will be overwritten.
+    [ -f $DEBIANCONFIG ] && . $DEBIANCONFIG
+
     db_get mdadm/mail_to
     MAILADDR="${RET:-root}"
 
@@ -112,17 +115,20 @@
 #   should mdadm start the MD monitoring daemon during boot?
 START_DAEMON=$START_DAEMON
 
+# VERBOSE=
+#   if this variable is set to true, mdadm will be a little more verbose e.g.
+#   when creating the initramfs.
+VERBOSE=${VERBOSE:-false}
+
 # MAIL_TO
 #   this variable is now managed in /etc/mdadm/mdadm.conf (MAILADDR).
 #   Please see mdadm.conf(5).
 
-# USE_DEPRECATED_MDRUN=
+# USE_DEPRECATED_MDRUN:
 #   mdrun is deprecated. If you still want to use it without a warning, set
 #   the following to true.
 #
-#   NOTE: changes to this variable will not be preserved!
-#
-USE_DEPRECATED_MDRUN=false
+USE_DEPRECATED_MDRUN=${USE_DEPRECATED_MDRUN:-false}
 _eof
 
     db_stop




More information about the pkg-mdadm-commits mailing list