r119 - in mdadm/trunk/debian: . initramfs

madduck at users.alioth.debian.org madduck at users.alioth.debian.org
Sun Aug 20 21:44:53 UTC 2006


Author: madduck
Date: 2006-08-20 21:44:51 +0000 (Sun, 20 Aug 2006)
New Revision: 119

Added:
   mdadm/trunk/debian/README.upgrading-2.5.3
Modified:
   mdadm/trunk/debian/
   mdadm/trunk/debian/FAQ
   mdadm/trunk/debian/NEWS
   mdadm/trunk/debian/README.initramfs-transition
   mdadm/trunk/debian/README.mdrun
   mdadm/trunk/debian/README.recipes
   mdadm/trunk/debian/UPGRADE-STRATEGY
   mdadm/trunk/debian/bugscript
   mdadm/trunk/debian/changelog
   mdadm/trunk/debian/checkarray
   mdadm/trunk/debian/control
   mdadm/trunk/debian/initramfs/hook
   mdadm/trunk/debian/initramfs/script.local-top
   mdadm/trunk/debian/mdadm-raid
   mdadm/trunk/debian/mdadm.config
   mdadm/trunk/debian/mdadm.cron.d
   mdadm/trunk/debian/mdadm.dirs
   mdadm/trunk/debian/mdadm.docs
   mdadm/trunk/debian/mdadm.init
   mdadm/trunk/debian/mdadm.postinst
   mdadm/trunk/debian/mdadm.postrm
   mdadm/trunk/debian/mdadm.preinst
   mdadm/trunk/debian/mdadm.templates
   mdadm/trunk/debian/mkconf
   mdadm/trunk/debian/rules
Log:
Sorry for the large commit, I have been working all day and chaotically, so
this is the reward. I am nearing a release, but it's not quite done...

changelog so far (this is for the pending 2.5.3.git2006whatever-1 release, and
includes previous "unreleased" entries).

   * Tracking upstream git releases.
     - now the --run switch behaves as stated in the manpage. This properly
       fixes #287415
     - new version-1 partitionable arrays are now named X instead of _dX (e.g.
       0 instead of _d0) for device names like md_dX. I actually think this is
       a bug and hope upstream will use dX (e.g. d0) instead in a future
       version.
   * Instead of trying to do a whole lot of magic with respect to detecting
     RAID devices to start, mdadm from now on requires a valid mdadm.conf file
     to be installed. It still tries to do what it can, but there are no
     heuristics anymore. See /usr/share/doc/mdadm/README.upgrading-2.5.3 .
   * Removed the zero-superblock warning because we require the user to sign
     off the configuration file anyway.
   * This also enables us to use mdadm.conf from the initial ramdisk and thus
     closes: #381303.
   * In case the user chooses to assemble all arrays from the initial ramdisk,
     use the new homehost feature of mdadm (closes: #381057). This will start
     only those arrays belonging to the local system, unless it is the first
     run on a system, in which case it will start all arrays and mark them as
     belonging to the local system.
   * Improved the debconf control script: integrated error messages into the
     frontends, and made it a bit smarter. Error messages can now be
     translated, and the script checks whether the user's choice is listed in
     the configuration file and only proceeds if it is, or the user chooses to
     ignore that it is not.
   * mkconf can now take a generate/force-generate parameter to write directly
     to /etc/mdadm/mdadm.conf. A second parameter specifies an alternate
     filename.
   * mkconf now outputs comments for the settings it suggests.
   * Removed all udev-related stuff. We must coexist with udev because there
     are setups that assemble arrays without mdadm, so the device nodes must be
     created by udev, if that is used.
     (closes: #382263, #382450, #383688, #383891, #383806, #382480)
     Staying at low urgency since these (RC) bugs only exist in unstable.
   * Now installs MD modules and mdadm/mdrun into initial ramdisk regardless of
     whether the hook script thinks there are devices to start. This was done
     to enable recovery from the initramfs shell.
   * Now uses 'MD' instead of 'RAID' consistently in all messages.
   * Now rebuilds initramfs for all installed kernels.
   * Now breaks the endless config loop only when the user does not see the
     question (see #381284, #381007).
   * Don't fail mdadm-raid when /dev is on a read-only filesystem
     (closes: #382876).
   * Updated debconf translations:
     - French by Florentin Duneau (closes: #382389).




Property changes on: mdadm/trunk/debian
___________________________________________________________________
Name: svn:ignore
   + *.substvars
files
mdadm
mdadm-udeb
*.debhelper
patched
.*.sw?
*.dch


Modified: mdadm/trunk/debian/FAQ
===================================================================
--- mdadm/trunk/debian/FAQ	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/FAQ	2006-08-20 21:44:51 UTC (rev 119)
@@ -3,8 +3,8 @@
 
 Also see /usr/share/doc/mdadm/README.recipes.gz
 
-1. How do I change the preferred minor of a RAID array?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. How do I change the preferred minor of a MD array?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   See item 12 in /usr/share/doc/mdadm/README.recipes.gz and read the mdadm
   manpage (search for 'preferred').
 

Modified: mdadm/trunk/debian/NEWS
===================================================================
--- mdadm/trunk/debian/NEWS	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/NEWS	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,3 +1,14 @@
+mdadm (2.5.3.git200608201206-1) unstable; urgency=low
+
+  This version makes mdadm.conf mandatory. If you do not have such a file, it
+  will be created for you.
+
+  You must verify the contents of this file and ensure that it represents your
+  local configuration. See /usr/share/doc/mdadm/README.upgrading-2.5.3 for
+  more information.
+
+ -- martin f. krafft <madduck at debian.org>  Sun, 20 Aug 2006 21:58:43 +0100
+
 mdadm (2.5-1) unstable; urgency=low
 
   mdrun has been (finally) obsoleted, and an appropriate warning message is

Modified: mdadm/trunk/debian/README.initramfs-transition
===================================================================
--- mdadm/trunk/debian/README.initramfs-transition	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/README.initramfs-transition	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,18 +1,16 @@
 mdadm for Debian - initramfs transition
 =======================================
 
-None of the following needs to concern you if you are using monolithic kernels
-(no modules), yaird, or initrd-tools/mkinitrd.
+If you are using monolithic kernels (no modules), you need not concern
+yourself with any of this.
 
-This information is about #367567. The gist is that the hooks and scripts to
-take care of RAID during boot with an initramfs have been improved and moved
-into the mdadm package. mdrun has been deprecated on the way.
+If you are using yaird or initrd-tools/mkinitrd, please see README.mdrun. The
+following information is irrelevant to you.
 
-As long as the version of initramfs-tools you have installed still provides
-the old hooks and scripts (which use mdrun), the new ones will simply not do
-anything (which allows me to get rid of the conflict I needed previously).
-Version 0.70 and later does not provide these hooks anymore, so the new mdadm
-hooks will be used, which use mdadm instead of mdrun.
+The following information is about #367567. The gist is that the hooks and
+scripts to take care of MD arrays during boot with an initramfs have been
+improved and moved into the mdadm package. mdrun has been deprecated on the
+way.
 
 initramfs-tools does *not* conflict with older mdadm but instead provides
 fallback code in case mdadm << 2.5-1 is installed (which does not provide the
@@ -29,7 +27,7 @@
 Also, you may want to provide yourself a safety net by making a copy of the
 initrd:
 
-  cp /boot/initrd.img-$(uname -r) /boot/initrd.img-$(uname -r).before-mdadm25
+  cp /boot/initrd.img-$(uname -r) /boot/initrd.img-$(uname -r).before-mdadm2
 
 and then to duplicate your main grub or lilo stanzas (rerun lilo!) and point
 them to the saved initrd. If things go haywire, you should be able to restore
@@ -49,6 +47,6 @@
 
 Again, please report success or failure to me.
 
- -- martin f. krafft <madduck at debian.org>  Mon, 31 Jul 2006 14:32:21 +0100
+ -- martin f. krafft <madduck at debian.org>  Mon, 20 Aug 2006 17:32:21 +0100
 
 $Id$

Modified: mdadm/trunk/debian/README.mdrun
===================================================================
--- mdadm/trunk/debian/README.mdrun	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/README.mdrun	2006-08-20 21:44:51 UTC (rev 119)
@@ -2,7 +2,7 @@
 ==================================
 
 mdadm for Debian ships with /sbin/mdrun, which is a sledgehammer approach to
-assembling RAID volumes during boot. Unfortunately, the script has several
+assembling MD arrays during boot. Unfortunately, the script has several
 problems (see e.g. #354705) and can cause major headaches.
 
 Fortunately, mdadm has since added all the functionality needed to replace
@@ -23,8 +23,8 @@
 
     to be able to run this command, you need to ensure that
     /etc/mdadm/mdadm.conf (or /etc/mdadm.conf, which is less preferred)
-    properly describes your RAID volumes. You can use the output generated by
-    the script /usr/share/mdadm/mkconf to help you migrate an existing
+    properly describes your MD arrays. You can use the output generated by the
+    script /usr/share/mdadm/mkconf to help you migrate an existing
     configuration or to create a new configuration file.
 
     You can find more information in the mdadm(8) and mdadm.conf(5) manpages.

Modified: mdadm/trunk/debian/README.recipes
===================================================================
--- mdadm/trunk/debian/README.recipes	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/README.recipes	2006-08-20 21:44:51 UTC (rev 119)
@@ -125,8 +125,8 @@
     mount /dev/md0 /home    # also change /etc/fstab
     mdadm --add /dev/md0 /dev/sda1
 
-12. change the preferred minor of a RAID array
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+12. change the preferred minor of an MD array
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     # you need to manually assemble the array to change the preferred minor
     # if you manually assemble, the superblock will be updated to reflect
     # the preferred minor as you indicate with the assembly.

Added: mdadm/trunk/debian/README.upgrading-2.5.3
===================================================================
--- mdadm/trunk/debian/README.upgrading-2.5.3	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/README.upgrading-2.5.3	2006-08-20 21:44:51 UTC (rev 119)
@@ -0,0 +1,33 @@
+upgrading to mdadm 2.5.3 from previous versions
+===============================================
+
+With version 2.5.3, the Debian mdadm package now requires a mdadm.conf file.
+This file should be in /etc/mdadm/mdadm.conf, although /etc/mdadm.conf will
+also be read if the former is not present, but it is less preferred.
+
+The reason the configuration file is now required is because it was impossible
+to come up with robust heuristics to replace the previously used mdrun, while
+addressing its primary deficiency of not honouring the super-minor field and
+randomly assembling devices (see #354705).
+
+Systems without a mdadm.conf file
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If your system does not have an mdadm.conf file, the package creates one for
+your during the installation phase. Furthermore, a configuration file is
+created during the updating of the initramfs (initial ramdisk), if no file is
+found at the time. In both cases, the running system is used as a reference,
+meaning that the file is generated automatically in such a way as to reflect
+the running system.
+
+This should work in most cases. I strongly suggest, however, that you inspect
+the generated file (/etc/mdadm/mdadm.conf) before you reboot. If you find any
+anomaly or mistakes, correct them and proceed with the next step ("Systems
+with a mdadm.conf file").
+
+Systems with a mdadm.conf file
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If an existing configuration file was found, 
+
+ -- martin f. krafft <madduck at debian.org>  Mon, 20 Aug 2006 19:11:21 +0100
+
+$Id: README.initramfs-transition 89 2006-08-08 09:33:05Z madduck $

Modified: mdadm/trunk/debian/UPGRADE-STRATEGY
===================================================================
--- mdadm/trunk/debian/UPGRADE-STRATEGY	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/UPGRADE-STRATEGY	2006-08-20 21:44:51 UTC (rev 119)
@@ -10,7 +10,7 @@
 
 We want to be able to deal with:
 
-  - any filesystem on RAID, including root and swap
+  - any filesystem on MD, including root and swap
   - assembly/starting by kernel, mdadm -A, and mdadm -As (mdrun)
   - partitionable arrays
   - plain /dev, udev, or devfs
@@ -22,8 +22,8 @@
 What do we have to worry about?
 
   - root must be mounted either by the initrd or by the kernel
-  - other RAIDs must be mounted either by the initrd or by the kernel or by
-    the init script
+  - other MD arrays must be mounted either by the initrd or by the kernel or
+    by the init script
   - device nodes must exist by the time the init script finished
     - no real need to worry about root, but good to have a device node on the
       running system anyway. See next point.

Modified: mdadm/trunk/debian/bugscript
===================================================================
--- mdadm/trunk/debian/bugscript	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/bugscript	2006-08-20 21:44:51 UTC (rev 119)
@@ -13,8 +13,8 @@
 set -eu
 
 if [ ! -r /proc/mdstat ]; then
-  echo "The local system does not have RAID support (no drivers loaded)."
-  echo "Without RAID support, I cannot collect as much information as I'd like."
+  echo "The local system does not have MD support (no drivers loaded)."
+  echo "Without MD support, I cannot collect as much information as I'd like."
 
   #yesno "Are you sure you want to report a bug at this time? " yep
   yesno "Hit any key to continue..."

Modified: mdadm/trunk/debian/changelog
===================================================================
--- mdadm/trunk/debian/changelog	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/changelog	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,45 +1,52 @@
-mdadm (2.5.3.git200608201206-1~unreleased.1) UNRELEASED; urgency=low
+mdadm (2.5.3.git200608202239-1~unreleased.1) UNRELEASED; urgency=low
 
-  * Tracking upstream git now.
-
- -- martin f. krafft <madduck at debian.org>  Fri, 11 Aug 2006 10:25:30 +0100
-
-mdadm (2.5.3-1~unreleased.5) UNRELEASED; urgency=low
-
-  * Improved udev integration.
-  * Updated debconf translations:
-    - French by Florentin Duneau (closes: #382389).
-  * Pushed build dependency to 5.0.32 and DH compatibility level to 5 because
-    of dh_installudev use (closes: #382480).
-  * Don't fail mdadm-raid when /dev is on a read-only filesystem
-    (closes: #382876).
-
- -- martin f. krafft <madduck at debian.org>  Sun, 13 Aug 2006 23:40:27 +0100
-
-mdadm (2.5.3-1~unreleased.4) UNRELEASED; urgency=low
-
-  * Readded udev rules, but consult a script now to figure out the name to
-    use. This should address #382263 appropriately. In the long run, I should
-    give the user a debconf question to decide which naming scheme to use.
-    Thanks to Marco d'Itri for his help.
-
- -- martin f. krafft <madduck at debian.org>  Thu, 10 Aug 2006 20:30:42 +0100
-
-mdadm (2.5.3-1~unreleased.3) UNRELEASED; urgency=low
-
-  * New upstream release.
+  * Tracking upstream git releases.
     - now the --run switch behaves as stated in the manpage. This properly
       fixes #287415
     - new version-1 partitionable arrays are now named X instead of _dX (e.g.
       0 instead of _d0) for device names like md_dX. I actually think this is
       a bug and hope upstream will use dX (e.g. d0) instead in a future
       version.
+  * Instead of trying to do a whole lot of magic with respect to detecting
+    RAID devices to start, mdadm from now on requires a valid mdadm.conf file
+    to be installed. It still tries to do what it can, but there are no
+    heuristics anymore. See /usr/share/doc/mdadm/README.upgrading-2.5.3 .
+  * Removed the zero-superblock warning because we require the user to sign
+    off the configuration file anyway.
+  * This also enables us to use mdadm.conf from the initial ramdisk and thus
+    closes: #381303.
+  * In case the user chooses to assemble all arrays from the initial ramdisk,
+    use the new homehost feature of mdadm (closes: #381057). This will start
+    only those arrays belonging to the local system, unless it is the first
+    run on a system, in which case it will start all arrays and mark them as
+    belonging to the local system.
+  * Improved the debconf control script: integrated error messages into the
+    frontends, and made it a bit smarter. Error messages can now be
+    translated, and the script checks whether the user's choice is listed in
+    the configuration file and only proceeds if it is, or the user chooses to
+    ignore that it is not.
+  * mkconf can now take a generate/force-generate parameter to write directly
+    to /etc/mdadm/mdadm.conf. A second parameter specifies an alternate
+    filename.
+  * mkconf now outputs comments for the settings it suggests.
+  * Removed all udev-related stuff. We must coexist with udev because there
+    are setups that assemble arrays without mdadm, so the device nodes must be
+    created by udev, if that is used.
+    (closes: #382263, #382450, #383688, #383891, #383806, #382480)
+    Staying at low urgency since these (RC) bugs only exist in unstable.
+  * Now installs MD modules and mdadm/mdrun into initial ramdisk regardless of
+    whether the hook script thinks there are devices to start. This was done
+    to enable recovery from the initramfs shell.
+  * Now uses 'MD' instead of 'RAID' consistently in all messages.
   * Now rebuilds initramfs for all installed kernels.
-  * Removed udev rules because it was causing unbootable systems when the
-    kernel autoassembly assembled the RAIDs (and not mdadm) and thus no device
-    nodes were created (closes: #382263).
+  * Now breaks the endless config loop only when the user does not see the
+    question (see #381284, #381007).
+  * Don't fail mdadm-raid when /dev is on a read-only filesystem
+    (closes: #382876).
+  * Updated debconf translations:
+    - French by Florentin Duneau (closes: #382389).
 
- -- martin f. krafft <madduck at debian.org>  Thu, 10 Aug 2006 14:56:47 +0100
+ -- martin f. krafft <madduck at debian.org>  Sun, 20 Aug 2006 22:38:03 +0100
 
 mdadm (2.5.2-10) unstable; urgency=low
 

Modified: mdadm/trunk/debian/checkarray
===================================================================
--- mdadm/trunk/debian/checkarray	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/checkarray	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# checkarray -- initiates a check run of an array's redundancy information.
+# checkarray -- initiates a check run of an MD array's redundancy information.
 #
 # Copyright © martin f. krafft <madduck at debian.org>
 # distributed under the terms of the Artistic Licence 2.0
@@ -14,7 +14,7 @@
 
 about()
 {
-  echo "$PROGNAME -- RAID redundancy checker tool"
+  echo "$PROGNAME -- MD array redundancy checker tool"
   echo '$Id$'
   echo "Copyright © martin f. krafft <madduck at debian.org>"
   echo "Released under the terms of the Artistic Licence 2.0"
@@ -99,7 +99,7 @@
 fi
 
 if [ ! -f /proc/mdstat ]; then
-  [ $quiet -lt 2 ] && echo "$PROGNAME: E: RAID subsystem not loaded, or /proc unavailable." >&2
+  [ $quiet -lt 2 ] && echo "$PROGNAME: E: MD subsystem not loaded, or /proc unavailable." >&2
   exit 2
 fi
 
@@ -109,7 +109,7 @@
 fi
 
 if [ -z "$(ls /sys/block/md* 2>/dev/null)" ]; then
-  [ $quiet -lt 2 ] && echo "$PROGNAME: W: no active RAID arrays found." >&2
+  [ $quiet -lt 2 ] && echo "$PROGNAME: W: no active MD arrays found." >&2
   [ $quiet -lt 2 ] && echo "$PROGNAME: W: (maybe uninstall the mdadm package?)" >&2
   exit 5
 fi

Modified: mdadm/trunk/debian/control
===================================================================
--- mdadm/trunk/debian/control	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/control	2006-08-20 21:44:51 UTC (rev 119)
@@ -12,7 +12,7 @@
 Recommends: mail-transport-agent
 Replaces: mdctl
 Conflicts: mdctl (<< 0.7.2), raidtools2 (<< 1.00.3-12.1), initramfs-tools (<< 0.65)
-Description: tool to administer Linux MD device arrays (software RAID)
+Description: tool to administer Linux MD arrays (software RAID)
  mdadm is a program that can be used to create, manage, and monitor MD
  devices (software RAID), as well as multipath devices.
 
@@ -21,7 +21,7 @@
 XC-Package-Type: udeb
 Architecture: any
 Depends: ${shlibs:Depends}
-Description: tool to administer Linux MD device arrays (software RAID)
+Description: tool to administer Linux MD arrays (software RAID)
  mdadm is a program that can be used to create, manage, and monitor MD
  devices (software RAID), as well as multipath devices.
  .

Modified: mdadm/trunk/debian/initramfs/hook
===================================================================
--- mdadm/trunk/debian/initramfs/hook	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/initramfs/hook	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,10 +1,14 @@
-#!/bin/sh -eu
+#!/bin/sh
 #
 # Copyright © 2006 Martin F. Krafft <madduck at debian.org>
 # based on the scripts in the initramfs-tools package.
 # released under the terms of the Artistic Licence.
 #
+# $Id$
+#
 
+set -eu
+
 PREREQ=""
 
 prereqs()
@@ -33,94 +37,127 @@
   exit 0
 fi
 
-MDADM=$(command -v mdadm)
+MDADM=$(command -v mdadm 2>/dev/null) || :
 [ -x $MDADM ] || exit 0
 
 [ -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 /etc/default/mdadm ] && . /etc/default/mdadm
+[ -s $DEBIANCONFIG ] && . $DEBIANCONFIG
 
-DEVS=''; LEVELS=''
-if [ "$INITRDSTART" != none ]; then
-  eval $(mdadm --examine --scan --config=partitions \
-    | while read a dev level num uuid; do
-      case "$dev" in
-        (/dev/md[0-9]*|/dev/md_d[0-9]*)
-          dev_part="${dev#/dev/md}"
-          devfs_name="/dev/md/${dev_part#_}"
-            if [ -b "$dev" ] && [ -b "$devfs_name" ] \
-                && expr "$INITRDSTART" : ".*${devfs_name}.*" >/dev/null; then
-              echo "W: mdadm: both $dev and $devfs_name exist, and $devfs_name appears to be used." >&2
-              echo "W: mdadm: applying workaround for mdadm bug, don't worry! (see #381181)" >&2
-              dev="$devfs_name"
-            fi
-          ;;
+[ ! -f $CONFIG ] && [ -f $ALTCONFIG ] && CONFIG=$ALTCONFIG
+if [ -f $CONFIG ]; then
+  if [ -e /var/lib/mdadm/CONF-UNCHECKED ]; then
+    # the file comes from an old installation and hence is not guaranteed to
+    # work. We thus refuse to work.
+
+    echo "E: mdadm: unchecked mdadm.conf file found." >&2
+    echo "I: mdadm: please read /usr/share/doc/mdadm/README.upgrading-2.5.3 ." >&2
+    echo "I: mdadm: leaving RAID initialisation to initramfs (mdrun)." >&2
+    exit 0
+  fi
+
+else
+  # there is no configuration file, so let's create one
+  if /usr/share/mdadm/mkconf generate $CONFIG; then
+    echo "I: mdadm: auto-generated the mdadm.conf configuration file." >&2
+  else
+    echo "E: mdadm: failed to autogenerate the mdadm.conf file." >&2
+    echo "I: mdadm: leaving RAID initialisation to initramfs (mdrun)." >&2
+    rm -f $CONFIG
+    exit 0
+  fi
+fi
+
+# install the configuration file
+mkdir -p $DESTDIR/etc/mdadm
+sed -e :a -re '$!N;s/\n[[:space:]]+/ /;ta' -ne '/^(ARRAY|DEVICE)/P;D' \
+  < $CONFIG > $DESTDIR/etc/mdadm/mdadm.conf
+
+# obtain dev:level pairs from config file, honouring multiline entries
+devpairs="$(
+  while read line; do
+    for atom in $line; do
+      case "$atom" in
+        (/dev*) dev=$atom;;
+        (level=*) level=${atom#level=};;
+        (*) :;;
       esac
+    done
+    [ -n "${dev:-}" ] && echo -n "${dev}:${level} "
+  done < $DESTDIR/etc/mdadm/mdadm.conf)"
 
-      if [ "$INITRDSTART" = all ] || expr "$INITRDSTART" : ".*${dev}.*" >/dev/null; then
-          uuid="${uuid#*UUID=}"
-          DEVS="$DEVS ${dev}=${uuid%% *}"
-          LEVELS="$LEVELS ${level#level=}"
-      fi
+copy_exec $MDADM /sbin
 
-      echo "DEVS='$DEVS'"
-      echo "LEVELS='$LEVELS'"
-    done)
+# copy all modules into the initramfs, just for safety.
+# we copy raid456 / raid5+raid6 because the hook script just won't do
+# anything when the module cannot be found.
+modules="linear multipath raid0 raid1 raid456 raid5 raid6 raid10"
+for mod in $modules; do manual_add_modules $mod; done
 
-  [ "$INITRDSTART" = all ] && DEVS=all
-fi
-
 uniquify()
 {
   for i in $@; do echo "$i"; done | sort -u
 }
 
-if [ -n "$DEVS" ]; then
-
-  homehost=$(sed -ne 's,^[[:space:]]*HOMEHOST[[:space:]]*,,p' \
-    /etc/mdadm.conf /etc/mdadm/mdadm.conf 2>/dev/null || :)
+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 "RAID_HOMEHOST='$homehost'" > DESTDIR/conf/raid.conf
-  echo "RAID_DEVS='${DEVS## }'" >> $DESTDIR/conf/raid.conf
-  echo "RAID_LEVELS='${LEVELS## }'" >> $DESTDIR/conf/raid.conf
+  echo "MD_HOMEHOST='$homehost'" > $DESTDIR/conf/md.conf
+  echo "MD_DEVPAIRS='${devpairs% }'" >> $DESTDIR/conf/md.conf
 
+  devs=''; levels=''
+  for i in $devpairs; do
+    dev=${i%:*}
+    level=${i##*:}
+    case "$INITRDSTART" in
+      all|*${dev}*)
+        devs="${devs:+$devs }$dev"
+        levels="${levels:+$levels }$level"
+        ;;
+      *) :;;
+    esac
+  done
+
+  echo "MD_LEVELS='$levels'" >> $DESTDIR/conf/md.conf
+  if [ "$INITRDSTART" = all ]; then
+    echo "MD_DEVS=all" >> $DESTDIR/conf/md.conf
+  else
+    echo "MD_DEVS='$devs'" >> $DESTDIR/conf/md.conf
+  fi
+
   # raid4 is handled by raid5
-  MODULES="$(echo $LEVELS | sed -e 's,raid4,raid5,g')"
+  modules="$(echo $levels | sed -e 's,raid4,raid5,g')"
 
   # if raid456 module is present, use it for raid[456]
   modprobe --set-version="$version" --show-depends raid456 >/dev/null 2>&1 \
-    && MODULES="$(echo $MODULES | sed -e 's,raid[456],raid456,g')"
+    && modules="$(echo $modules | sed -e 's,raid[456],raid456,g')"
 
-  MODULES="$(uniquify $MODULES | tr '\n' ' ')"
-  echo "RAID_MODULES='${MODULES%% }'" >> $DESTDIR/conf/raid.conf
+  modules="$(uniquify $modules | tr '\n' ' ')"
+  echo "MD_MODULES='${modules% }'" >> $DESTDIR/conf/md.conf
 
-  copy_exec $MDADM /sbin
-
-  # copy all modules into the initramfs, just for safety.
-  # we copy raid456 / raid5+raid6 because the hook script just won't do
-  # anything when the module cannot be found.
-  MODULES="linear multipath raid0 raid1 raid456 raid5 raid6 raid10"
-  for mod in $MODULES; do manual_add_modules $mod; done
-
-  if [ "$DEVS" = all ]; then
-    DEVNAMES="all RAID arrays"
+  if [ "$INITRDSTART" = all ]; then
+    echo "I: mdadm: will start all available MD arrays from the initial ramdisk." >&2
   else
-    DEVNAMES="$(for i in $DEVS; do echo -n "${i%=*},"; done)"
-    DEVNAMES="${DEVNAMES%,}"
+    for i in $devs; do
+      echo "I: mdadm: will start MD array $i from the initial ramdisk." >&2
+    done
   fi
 
-  echo "I: mdadm: RAID support installed to mount $DEVNAMES during boot." >&2
-
 else
-  echo "I: mdadm: no RAID devices selected for initrd initialisation." >&2
-  echo "I: mdadm: not including RAID stuff." >&2
+  echo "I: mdadm: 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 -plow mdadm` to change this.' >&2
+  echo 'I: mdadm: use `dpkg-reconfigure --priority=low mdadm` to change this.' >&2
 
 exit 0


Property changes on: mdadm/trunk/debian/initramfs/hook
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: mdadm/trunk/debian/initramfs/script.local-top
===================================================================
--- mdadm/trunk/debian/initramfs/script.local-top	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/initramfs/script.local-top	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,10 +1,14 @@
-#!/bin/sh -eu
+#!/bin/sh
 #
 # Copyright © 2006 Martin F. Krafft <madduck at debian.org>
 # based on the scripts in the initramfs-tools package.
 # released under the terms of the Artistic Licence.
 #
+# $Id$
+#
 
+set -eu
+
 PREREQ="udev_helper"
 
 prereqs()
@@ -22,7 +26,7 @@
 . /scripts/functions
 
 if [ -e /scripts/local-top/md ]; then
-  log_failure_msg "old RAID initialisation script found, getting out of its way..."
+  log_failure_msg "old md initialisation script found, getting out of its way..."
   exit 1
 fi
 
@@ -38,12 +42,17 @@
   esac
 }
 
-[ -s /conf/raid.conf ] && . /conf/raid.conf
+MD_DEVS=all
+MD_MODULES='linear multipath raid0 raid1 raid456 raid5 raid6 raid10'
+[ -s /conf/md.conf ] && . /conf/md.conf
 
-$MDADM --examine --scan --config=partitions > /etc/mdadm.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 RAID modules
-for module in ${RAID_MODULES:-}; do
+verbose && log_begin_msg Loading MD modules
+for module in ${MD_MODULES:-}; do
   if modprobe --syslog "$module"; then
     verbose && log_success_msg "loaded module ${module}."
   else
@@ -53,18 +62,21 @@
 log_end_msg
 
 if [ ! -f /proc/mdstat ]; then
-  verbose && panic "cannot initialise RAID subsystem (/proc/mdstat missing)"
+  verbose && panic "cannot initialise MD subsystem (/proc/mdstat missing)"
   exit 1
 fi
 
 # handle /dev/md/X nodes
 mkdir --parent /dev/md
 
-if [ ${RAID_DEVS:-all} = all ]; then
+if [ "$MD_DEVS" = all ]; then
   
-  verbose && log_begin_msg "Assembling all RAID arrays"
+  verbose && log_begin_msg "Assembling all MD arrays"
   
-  if $MDADM --assemble --config=/etc/mdadm.conf --scan --run --auto=yes; then
+  extra_args=''
+  [ -n "$MD_HOMEHOST" ] && \
+    extra_args="--homehost='$MD_HOMEHOST' --auto-update-homehost"
+  if $MDADM --assemble --scan --run --auto=yes $extra_args; then
     verbose && log_success_msg "success"
   else
     verbose && log_failure_msg "failed"
@@ -73,17 +85,14 @@
   verbose && log_end_msg
 
 else
-  for dev in ${RAID_DEVS:-}; do
+  for dev in $MD_DEVS; do
 
-    DEV=${dev%=*}
-    UUID=${dev#*=}
+    verbose && log_begin_msg "Assembling MD array $dev"
 
-    verbose && log_begin_msg "Assembling RAID array $DEV ($UUID)"
-
-    if $MDADM --assemble --config=partitions --run --auto=yes --uuid $UUID $DEV; then
-      verbose && log_success_msg "started $DEV ($UUID)"
+    if $MDADM --assemble --run --auto=yes $dev; then
+      verbose && log_success_msg "started $dev"
     else
-      verbose && log_failure_msg "failed to start $DEV ($UUID)"
+      verbose && log_failure_msg "failed to start $dev"
     fi
 
     verbose && log_end_msg


Property changes on: mdadm/trunk/debian/initramfs/script.local-top
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: mdadm/trunk/debian/mdadm-raid
===================================================================
--- mdadm/trunk/debian/mdadm-raid	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm-raid	2006-08-20 21:44:51 UTC (rev 119)
@@ -69,14 +69,14 @@
 
 case "${1:-}" in
   start)
-    PREFIX="Assembling RAID array"
+    PREFIX="Assembling MD array"
 
     if is_true $AUTOSTART; then
       if [ ! -f /proc/mdstat ] && [ -x "$(command -v modprobe)" ] ; then
         modprobe -kq md 2>/dev/null || :
       fi
       if [ ! -f /proc/mdstat ]; then
-        log_problem "failed to load RAID subsystem"
+        log_problem "failed to load MD subsystem"
         exit 0
       fi
 
@@ -152,11 +152,11 @@
     ;;
 
   stop)
-    PREFIX="Stopping RAID array"
+    PREFIX="Stopping MD array"
 
     if is_true $AUTOSTART; then
       if [ ! -f /proc/mdstat ]; then
-        log_problem "no RAID subsystem loaded"
+        log_problem "no MD subsystem loaded"
         exit 0
       fi
 
@@ -206,7 +206,7 @@
     ;;
 
   reload)
-    PREFIX="Reloading RAID array"
+    PREFIX="Reloading MD array"
     log_notice "never anything to do"
     ;;
 

Modified: mdadm/trunk/debian/mdadm.config
===================================================================
--- mdadm/trunk/debian/mdadm.config	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.config	2006-08-20 21:44:51 UTC (rev 119)
@@ -50,26 +50,28 @@
   [ -n "$MAILADDR" ] && db_set mdadm/mail_to "$MAILADDR"
 fi
 
-db_input high mdadm/warning || true
-db_go
-
-db_fget mdadm/initrdstart seen || true
+db_fget mdadm/initrdstart seen
 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
+  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"
+    # remove partition from partitionable array
+    INITRDSTART="${rootraiddev%p[0-9]*}"
   fi
 fi
 
 [ -n "$INITRDSTART" ] && db_set mdadm/initrdstart "$INITRDSTART"
 
-cnt=0
+db_capb escape
+
+msg=intro; suffix=''
 while true; do
-  db_input low mdadm/initrdstart || true
+  db_metaget mdadm/initrdstart_msg_${msg} extended_description || :
+  db_subst mdadm/initrdstart msg "$(echo -e "${RET}${suffix}" | debconf-escape -e)"
+  ret=0; db_input low mdadm/initrdstart || ret=$?
   db_go
 
   db_get mdadm/initrdstart
@@ -80,44 +82,65 @@
     all) break;;
 
     *)
-      ARRAYS=''
-      ERROR=0
+      arrays=''
+      error=0
       for i in $INITRDSTART; do
 
         # standardise by prefixing /dev/
         i="/dev/${i#/dev/}"
 
         if [ ! -e "$i" ]; then
-          echo "E: device node does not exist: $i" >&2
-          ERROR=1; break
+          error=1; msg=errexist; suffix=": $i"; break
         fi
 
         if [ ! -b "$i" ]; then
-          echo "E: not a block device: $i" >&2
-          ERROR=1; break
+          t="$(readlink -nf "$i")"
+          if [ ! -b "$t" ]; then
+            suffix=": $t"
+          else
+            suffix=": $i"
+          fi
+          error=1; msg=errblock; break
         fi
 
         if ! mdadm --detail "$i" >/dev/null 2>&1; then
-          echo "E: not a RAID array: $i" >&2
-          ERROR=1; break
+          error=1; msg=errmd; suffix=": $i"; break
         fi
         
-        # remove partition from name of partitionable devices
-        i="${i%p[0-9]*}"
+        if [ -f $CONFIG ]; then
+          if ! egrep -q "^ARRAY[[:space:]]+$i[[:space:]]+" $CONFIG; then
+            t="$(readlink -nf "$i")"
+            if [ -L "$i" ] \
+                && egrep -q "^ARRAY[[:space:]]+$t[[:space:]]+" $CONFIG; then
+              i="$t"
+            else
+              db_subst mdadm/initrdstart_notinconf array "$i"
+              db_subst mdadm/initrdstart_notinconf config "$CONFIG"
+              db_input high mdadm/initrdstart_notinconf || :
+              db_go
+              db_get mdadm/initrdstart_notinconf
+              if [ "$RET" = true ]; then
+                md5sum $CONFIG > /var/lib/mdadm/CONF-UNCHECKED
+              else
+                db_fset mdadm/initrdstart seen false
+                error=1; msg=errconf; suffix=": $i"; break
+              fi
+            fi
+          fi
+        fi
 
         # uniquely add device name
-        echo $ARRAYS | egrep -q "\b${i}\b" || ARRAYS="${ARRAYS:+$ARRAYS }$i"
+        echo $arrays | egrep -q "\b${i}\b" || arrays="${arrays:+$arrays }$i"
       done
 
-      if [ $ERROR -eq 0 ]; then
-        INITRDSTART="$ARRAYS"
+      if [ $error -eq 0 ]; then
+        INITRDSTART="$arrays"
         # exit the while true loop
         break
       fi
 
-      cnt=$((cnt + 1))
-      if [ $cnt -eq 3 ]; then
-        echo "W: unable to determine RAID arrays needed for boot." >&2
+      if [ $ret -eq 30 ]; then
+        echo "W: unable to determine MD arrays needed for boot." >&2
         echo "W: falling back to starting all of them..." >&2
         INITRDSTART=all
         break
@@ -129,18 +152,18 @@
 db_set mdadm/initrdstart "$INITRDSTART"
 
 if [ "$INITRDSTART" != all ]; then
-  db_input high mdadm/autostart || true
+  db_input high mdadm/autostart || :
   db_go
 fi
 
-db_input medium mdadm/autocheck || true
+db_input medium mdadm/autocheck || :
 db_go
 
-db_input medium mdadm/start_daemon || true
+db_input medium mdadm/start_daemon || :
 db_go
 
-db_get mdadm/start_daemon
+db_get mdadm/start_daemon || :
 if [ "$RET" = true ]; then
-  db_input medium mdadm/mail_to || true
+  db_input medium mdadm/mail_to || :
   db_go
 fi

Modified: mdadm/trunk/debian/mdadm.cron.d
===================================================================
--- mdadm/trunk/debian/mdadm.cron.d	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.cron.d	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,5 +1,5 @@
 #
-# cron.d/mdadm -- schedules periodic parity checks of RAID devices
+# cron.d/mdadm -- schedules periodic redundancy checks of MD devices
 #
 # Copyright © martin f. krafft <madduck at madduck.net>
 # distributed under the terms of the Artistic Licence 2.0

Modified: mdadm/trunk/debian/mdadm.dirs
===================================================================
--- mdadm/trunk/debian/mdadm.dirs	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.dirs	2006-08-20 21:44:51 UTC (rev 119)
@@ -6,4 +6,4 @@
 usr/share/bug/mdadm
 usr/share/lintian/overrides
 var/lib/mdadm
-lib/udev
+#lib/udev

Modified: mdadm/trunk/debian/mdadm.docs
===================================================================
--- mdadm/trunk/debian/mdadm.docs	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.docs	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,6 +1,7 @@
 TODO
 debian/README.recipes
 debian/README.initramfs-transition
+debian/README.upgrading-2.5.3
 debian/README.mdrun
 debian/README.checkarray
 debian/FAQ

Modified: mdadm/trunk/debian/mdadm.init
===================================================================
--- mdadm/trunk/debian/mdadm.init	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.init	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Start the RAID monitor daemon for all active md arrays if desired.
+# Start the MD monitor daemon for all active MD arrays if desired.
 #
 # Copyright © 2001-2005 Mario Jou/3en <joussen at debian.org>
 # Copyright © 2005-2006 Martin F. Krafft <madduck at debian.org>
@@ -36,7 +36,7 @@
 case "${1:-}" in
   start)
     if is_true $START_DAEMON; then
-      log_daemon_msg "Starting RAID monitoring service" "mdadm --monitor"
+      log_daemon_msg "Starting MD monitoring service" "mdadm --monitor"
       mkdir -p $RUNDIR
       set +e
       start-stop-daemon -S -p $PIDFILE -x $MDADM -- \
@@ -47,7 +47,7 @@
     ;;
   stop)
     if [ -f $PIDFILE ] ; then
-      log_daemon_msg "Stopping RAID monitoring service" "mdadm --monitor"
+      log_daemon_msg "Stopping MD monitoring service" "mdadm --monitor"
       set +e
       start-stop-daemon -K -p $PIDFILE -x $MDADM
       rm -f $PIDFILE

Modified: mdadm/trunk/debian/mdadm.postinst
===================================================================
--- mdadm/trunk/debian/mdadm.postinst	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.postinst	2006-08-20 21:44:51 UTC (rev 119)
@@ -6,74 +6,71 @@
 # $Id$
 #
 
+. /usr/share/debconf/confmodule
+# See #369953 for ordering
 set -eu
 
-if [ "${1:-}" = "configure" ]; then
+case "${1:-}" in
+  configure|reconfigure)
 
-  set +u # debconf workaround. See #369953
-  . /usr/share/debconf/confmodule
-  set -u
+    if [ ! -f /proc/mdstat ] && [ -x $(command -v modprobe) ]; then
+      modprobe -k md >/dev/null 2>&1 || :
+    fi
+    if [ ! -f /proc/mdstat ]; then
+      echo 'W: failed to load MD subsystem.' >&2
+    fi
 
-  if [ ! -f /proc/mdstat ] && [ -x $(command -v modprobe) ]; then
-    modprobe -k md >/dev/null 2>&1 || :
-  fi
-  if [ ! -f /proc/mdstat ]; then
-    echo 'W: failed to load RAID subsystem.' >&2
-  fi
+    if [ ! -e /dev/md15 ] \
+      && [ ! -e /dev/.static/dev/md15 ] \
+      && [ ! -e /dev/.devfsd ]; then
 
-  if [ ! -e /dev/md15 ] \
-    && [ ! -e /dev/.static/dev/md15 ] \
-    && [ ! -e /dev/.devfsd ]; then
+        echo -n 'Generating array device nodes... ' >&2
+        cd /dev
+        if /sbin/MAKEDEV md >&2 >/dev/null; then
+          echo 'done.' >&2
+        else
+          echo 'failed.' >&2
+        fi
+    fi
 
-      echo -n 'Generating array device nodes... ' >&2
-      cd /dev
-      if /sbin/MAKEDEV md >&2 >/dev/null; then
-        echo 'done.' >&2
-      else
-        echo 'failed.' >&2
-      fi
-  fi
+    DEBIANCONFIG=/etc/default/mdadm
+    CONFIG=/etc/mdadm/mdadm.conf
+    ALTCONFIG=/etc/mdadm.conf
+    MDADM=/sbin/mdadm
 
-  DEBIANCONFIG=/etc/default/mdadm
-  CONFIG=/etc/mdadm/mdadm.conf
-  ALTCONFIG=/etc/mdadm.conf
-  MDADM=/sbin/mdadm
+    if [ -z "$2" ] && [ -s /etc/mdctl/mdctl.conf ] \
+        && [ ! -f /etc/mdadm/mdadm.conf ]; then
+      cp -a /etc/mdctl/mdctl.conf /etc/mdadm/mdadm.conf
+    fi
 
-  if [ -z "$2" ] && [ -s /etc/mdctl/mdctl.conf ] \
-      && [ ! -f /etc/mdadm/mdadm.conf ]; then
-    cp -a /etc/mdctl/mdctl.conf /etc/mdadm/mdadm.conf
-  fi
-
-  if [ ! -f $CONFIG ] && [ ! -f $ALTCONFIG ]; then
-    echo -n 'Generating mdadm.conf... ' >&2
-    if /usr/share/mdadm/mkconf >$CONFIG 2>/dev/null; then
-      md5sum $CONFIG > /var/lib/mdadm/mdadm.conf-generated
-      echo done. >&2
-    else
-      echo "failed (/proc probably not mounted)." >&2
-      rm -f $CONFIG
+    [ ! -f $CONFIG ] && [ -f $ALTCONFIG ] && CONFIG=$ALTCONFIG
+    if [ ! -f $CONFIG ]; then
+      echo -n 'Generating mdadm.conf... ' >&2
+      if /usr/share/mdadm/mkconf generate $CONFIG 2>/dev/null; then
+        echo done. >&2
+      else
+        echo "failed (/proc probably not mounted)." >&2
+        rm -f $CONFIG
+      fi
+    elif dpkg --compare-versions "${2:-2.5.3-1}" le 2.5.3-1; then
+      # we're upgrading from before 2.5.3-1 and there's apparently already
+      # a connfiguration file which we cannot verify. We'll use the sentinel
+      # during initramfs creation.
+      md5sum $CONFIG > /var/lib/mdadm/CONF-UNCHECKED
     fi
-  elif dpkg --compare-versions "${2:-2.5.3-1}" le 2.5.3-1
-    # we're upgrading from before 2.5.3-1 and there's apparently already
-    # a connfiguration file which we cannot verify. We'll use the sentinel
-    # during initramfs creation.
-    touch /var/lib/mdadm/CONF-UNCHECKED
-  fi
 
-  [ ! -f $CONFIG ] && CONFIG=$ALTCONFIG
+    db_get mdadm/initrdstart
+    INITRDSTART="${RET:-all}"
+    db_get mdadm/autostart
+    AUTOSTART="${RET:-true}"
+    db_get mdadm/autocheck
+    AUTOCHECK="${RET:-true}"
+    db_get mdadm/start_daemon
+    START_DAEMON="${RET:-true}"
+    db_get mdadm/mail_to
+    MAILADDR="${RET:-root}"
 
-  db_get mdadm/initrdstart
-  INITRDSTART="${RET:-all}"
-  db_get mdadm/autostart
-  AUTOSTART="${RET:-true}"
-  db_get mdadm/autocheck
-  AUTOCHECK="${RET:-true}"
-  db_get mdadm/start_daemon
-  START_DAEMON="${RET:-true}"
-  db_get mdadm/mail_to
-  MAILADDR="${RET:-root}"
-
-  cat <<_eof > $DEBIANCONFIG
+    cat <<_eof > $DEBIANCONFIG
 # mdadm Debian configuration
 #
 # You can run 'dpkg-reconfigure mdadm' to modify the values in this file, if
@@ -99,7 +96,7 @@
 AUTOCHECK=$AUTOCHECK
 
 # START_DAEMON:
-#   should mdadm start the RAID monitoring daemon during boot?
+#   should mdadm start the MD monitoring daemon during boot?
 START_DAEMON=$START_DAEMON
 
 # MAIL_TO
@@ -115,15 +112,27 @@
 USE_DEPRECATED_MDRUN=false
 _eof
 
-  if grep -q '^MAILADDR' $CONFIG; then
-    sed -i -e "s,^MAILADDR.*,MAILADDR $MAILADDR," $CONFIG
-  else
-    echo "MAILADDR $MAILADDR" >> $CONFIG
-  fi
+    if grep -q '^MAILADDR' $CONFIG; then
+      sed -i -e "s,^MAILADDR.*,MAILADDR $MAILADDR," $CONFIG
+    else
+      echo "MAILADDR $MAILADDR" >> $CONFIG
+    fi
 
-  db_stop
+    db_stop
 
-  command -v update-initramfs >/dev/null && update-initramfs -u -k all
+    command -v update-initramfs >/dev/null && update-initramfs -u -k all
+    ;;
+esac
+
+# remove S04 installed as a fix to #294404 as it does not work
+# we only remove the startup links if the previous version was 1.9.0-2.1 (the
+# one with the erroneous fix) and the S04 link exists to make sure that
+# chances are minimised to overwrite admin changes (even though this would
+# not affect woody upgraders)
+if [ "${1:-}" = "configure" ] && [ "${2:-}" = "1.9.0-2.1" ] \
+   && test -L /etc/rcS.d/S04mdadm-raid;
+then 
+	update-rc.d -f mdadm-raid remove
 fi
 
 # See #369953
@@ -141,17 +150,6 @@
   fi
 fi
 
-# remove S04 installed as a fix to #294404 as it does not work
-# we only remove the startup links if the previous version was 1.9.0-2.1 (the
-# one with the erroneous fix) and the S04 link exists to make sure that
-# chances are minimised to overwrite admin changes (even though this would
-# not affect woody upgraders)
-if [ "${1:-}" = "configure" ] && [ "${2:-}" = "1.9.0-2.1" ] \
-   && test -L /etc/rcS.d/S04mdadm-raid;
-then 
-	update-rc.d -f mdadm-raid remove
-fi
-
 # try to undo udev rules (installed by 2.5.2-10, see 2.5.3-1 changelog)
 # commented original install snippet included below
 if false && [ "${1:-}" = "configure" ] && [ "${2:-}" = "2.5.2-10" ]; then

Modified: mdadm/trunk/debian/mdadm.postrm
===================================================================
--- mdadm/trunk/debian/mdadm.postrm	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.postrm	2006-08-20 21:44:51 UTC (rev 119)
@@ -11,7 +11,7 @@
 case "${1:-}" in
   remove)
     if command -v update-initramfs >/dev/null; then
-      echo "W: mdadm: I'll update the initramfs, but if you need RAID to boot" >&2
+      echo "W: mdadm: I'll update the initramfs, but if you need MD to boot" >&2
       echo "W: mdadm: with initramfs, you'll be screwed!" >&2
       update-initramfs -u -k all
     fi
@@ -19,10 +19,11 @@
 
   purge)
     rm -f /etc/default/mdadm
-    if [ -f /var/lib/mdadm/mdadm.conf-generated ]; then
-      rm -f /etc/mdadm/mdadm.conf
+    GEN_SENTINEL=/var/lib/mdadm/mdadm.conf-generated
+    if [ -r $GEN_SENTINEL ]; then
+      rm -f "$(sed -rne 's,[[:xdigit:]]+  ,,p' $GEN_SENTINEL)"
     fi
-    rm -rf /var/lib/mdadm/CONF-UNCHECKED
+    rm -rf /var/lib/mdadm
     ;;
 
   *) :;;

Modified: mdadm/trunk/debian/mdadm.preinst
===================================================================
--- mdadm/trunk/debian/mdadm.preinst	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.preinst	2006-08-20 21:44:51 UTC (rev 119)
@@ -19,12 +19,13 @@
     fi
 
     # save the v1 output of -Es just in case we need it for upgrades
-    MDADM="$(command -v mdadm 2>/dev/null)"
-    if [ -x "$MDADM" ] && dpkg --compare-versions "${2:-1}" lt 2; then
+    MDADM="$(command -v mdadm 2>/dev/null || :)"
+    if [ -x "$MDADM" ] && [ -n "${2:-}" ] && \
+        dpkg --compare-versions $2 lt 2; then
       echo DEVICE partitions > /var/backups/mdadm-Es_v1.dump
-      $MDADM -Esc /var/backups/mdadm-Es_v1.dump >> /var/backups/mdadm-Es_v1.dump
+      $MDADM -Esc /var/backups/mdadm-Es_v1.dump >> /var/backups/mdadm-Es_v1.dump || :
     fi
-  ;;
+    ;;
 
   *) :;;
 esac

Modified: mdadm/trunk/debian/mdadm.templates
===================================================================
--- mdadm/trunk/debian/mdadm.templates	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mdadm.templates	2006-08-20 21:44:51 UTC (rev 119)
@@ -1,56 +1,73 @@
-Template: mdadm/warning
-Type: note
-_Description: Initialise the superblock if you reuse hard disks
- WARNING! If you are using hard disks which have RAID superblocks from earlier
- installations in different RAID arrays, you MUST zero each superblock
- *before* activating the autostart feature.
- .
- To do this, do not start the RAID devices automatically. First, zero the
- superblock (mdadm --zero-superblock /dev/mdX). Next, use `dpkg-reconfigure
- mdadm` to reactivate the autostart feature.
- .
- If you manage your RAIDs otherwise (e.g. EVMS), either disable autostart, or
- ensure that /etc/mdadm/mdadm.conf only lists those arrays you want to start
- by mdadm.
-
 Template: mdadm/initrdstart
 Type: string
 Default: all
-_Description: RAID arrays needed for the root filesystem:
- If your system has its root filesystem on a RAID volume, it needs to be
+_Description: MD arrays needed for the root filesystem:
+ ${msg}
+ .
+ Please enter a space-separated list of devices, 'all', or 'none'. You may
+ omit the leading '/dev/' and just enter e.g. "md0 md1", or "md/1 md/d0".
+
+Template: mdadm/initrdstart_msg_intro
+Type: text
+_Description: 
+ If your system has its root filesystem on a MD volume, it needs to be
  started early during the boot sequence. If your root filesystem is on
- a logical volume (LVM), which is on RAID, all constituent arrays need to be
+ a logical volume (LVM), which is on MD, all constituent arrays need to be
  started.
  .
  If you know exactly which arrays are needed to bring up the root filesystem,
- enter them here. Alternatively, enter 'all' to simply start all available
- arrays. If you do not need or want to start any arrays for the root
- filesystem, leave the answer blank (or enter 'none').
+ and you want to postpone starting all other arrays to a later point in the
+ boot sequence, enter the arrays to start here. Alternatively, enter 'all' to
+ simply start all available arrays. If you do not need or want to start any
+ arrays for the root filesystem, leave the answer blank (or enter 'none').
+
+Template: mdadm/initrdstart_msg_errexist
+Type: text
+_Description:
+ An error occurred: device node does not exist
+
+Template: mdadm/initrdstart_msg_errblock
+Type: text
+_Description:
+ An error occurred: not a block device
+
+Template: mdadm/initrdstart_msg_errmd
+Type: text
+_Description:
+ An error occurred: not a MD array
+
+Template: mdadm/initrdstart_msg_errconf
+Type: text
+_Description:
+ An error occurred: array not listed in mdadm.conf file
+
+Template: mdadm/initrdstart_notinconf
+Type: boolean
+Default: false
+_Description: Proceed with starting arrays not listed in mdadm.conf?
+ The array you have specified (${array}) is not listed in the configuration
+ file ${config}. Therefore it cannot be started during boot, unless you
+ correct the configuration file and recreate the initial ramdisk.
  .
- You have the option to start all other arrays (those not needed for the root
- filesystem) later in the boot sequence. Doing so will give you greater
- control over the arrays with the mdadm configuration file. Starting all
- arrays at boot-time may be safer though.
- .
- Please enter a space-separated list of devices, or 'all'. You may omit the
- leading '/dev/' and just enter e.g. "md0 md1".
+ Please refer to /usr/share/doc/mdadm/README.upgrading-2.5.3 if you intend to
+ continue.
 
 Template: mdadm/autostart
 Type: boolean
 Default: true
-_Description: Do you want to start RAID devices automatically?
- Once the base system has come up, mdadm can start all RAID devices specified
+_Description: Do you want to start MD devices automatically?
+ Once the base system has come up, mdadm can start all MD devices specified
  in /etc/mdadm/mdadm.conf, which have not yet been started. Unless you have
- compiled RAID support into the kernel (in which case all RAID arrays with
+ compiled MD support into the kernel (in which case all MD arrays with
  partitions of type 0xfd (and only those) are started automatically anyway),
  this is probably what you want.
 
 Template: mdadm/autocheck
 Type: boolean
 Default: true
-_Description: Should mdadm run monthly redundancy checks of the RAID arrays?
+_Description: Should mdadm run monthly redundancy checks of the MD arrays?
  If your kernel supports it (>> 2.6.14), mdadm can periodically check the
- redundancy of your RAID devices. This may be a resource-intensive process,
+ redundancy of your MD devices. This may be a resource-intensive process,
  depending on your setup, but it could help prevent rare cases of data loss.
  Note that this is a read-only check unless errors are found; if errors are
  found, mdadm will try to correct them, which may result in write access to
@@ -62,13 +79,13 @@
 Template: mdadm/start_daemon
 Type: boolean
 Default: true
-_Description: Do you want to start the RAID monitoring daemon?
- The RAID monitor daemon sends email notifications in response to important
- RAID events (such as a disk failure). You probably want to enable it.
+_Description: Do you want to start the MD monitoring daemon?
+ The MD monitor daemon sends email notifications in response to important
+ MD events (such as a disk failure). You probably want to enable it.
 
 Template: mdadm/mail_to
 Type: string
 Default: root
 _Description: Recipient for email notifications:
  Please enter the email address of the user who should get the email
- notification for these important RAID events.
+ notification for these important MD events.

Modified: mdadm/trunk/debian/mkconf
===================================================================
--- mdadm/trunk/debian/mkconf	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/mkconf	2006-08-20 21:44:51 UTC (rev 119)
@@ -20,21 +20,67 @@
 
 test -f $DEBIANCONFIG && . $DEBIANCONFIG
 
+generate=0
+CONFIG=/etc/mdadm/mdadm.conf
+[ "${1:-}" = force-generate ] && rm -f $CONFIG
+case "${1:-}" in
+  generate|force-generate)
+    [ -n "${2:-}" ] && CONFIG=$2
+    if [ -e $CONFIG ]; then
+      echo "E: ${##*/}: $CONFIG already exists." >&2
+      exit 3
+    fi
+    
+    mkdir --parent ${CONFIG%/*}
+    exec >$CONFIG
+    generate=1
+    ;;
+esac
+
+cat <<_eof
+# mdadm.conf
+#
+# This file was auto-generated on $(date -R)
+# by mkconf \$Id$
+#
+# Please refer to mdadm.conf(5) for information about this file.
+#
+
+_eof
+
 if [ -r /proc/partitions ]; then
-  echo DEVICE partitions
+  cat <<_eof
+# scan all partitions (/proc/partitions) for MD superblocks"
+DEVICE partitions
+
+_eof
 else
   echo E: cannot read /proc/partitions and thus cannot do my magic. >&2
   exit 1
 fi
 
-echo CREATE owner=root group=disk mode=0660 auto=yes metadata=1
-echo HOMEHOST '<system>'
-echo MAILADDR root
+cat <<_eof
+# auto-create devices with Debian standard permissions and v1 superblocks
+CREATE owner=root group=disk mode=0660 auto=yes metadata=1
 
+# automatically tag new arrays as belonging to the local system
+HOMEHOST <system>
+
+# instruct the monitoring daemon to send mail alerts to root
+MAILADDR root
+
+_eof
+
 if [ ! -r /proc/mdstat ]; then
-  echo W: RAID subsystem is not loaded, thus I cannot scan for arrays. >&2
+  echo W: MD subsystem is not loaded, thus I cannot scan for arrays. >&2
 else
+  echo "# definitions of existing MD arrays"
   $MDADM --examine --scan --config=partitions
 fi
 
+if [ $generate -eq 1 ]; then
+  mkdir -p /var/lib/mdadm
+  md5sum $CONFIG > /var/lib/mdadm/mdadm.conf-generated
+fi
+
 exit 0

Modified: mdadm/trunk/debian/rules
===================================================================
--- mdadm/trunk/debian/rules	2006-08-20 14:23:03 UTC (rev 118)
+++ mdadm/trunk/debian/rules	2006-08-20 21:44:51 UTC (rev 119)
@@ -83,7 +83,7 @@
 	install -m0755 debian/mkconf $(DESTDIR)/usr/share/mdadm
 	install -m0755 debian/checkarray $(DESTDIR)/usr/share/mdadm
 	install -m0755 debian/bugscript $(DESTDIR)/usr/share/bug/mdadm/script
-	install -m0755 debian/mdadm-name-generator.sh $(DESTDIR)/lib/udev
+#	install -m0755 debian/mdadm-name-generator.sh $(DESTDIR)/lib/udev
 
 	install -m0644 debian/mdadm.lintian-overrides \
 		$(DESTDIR)/usr/share/lintian/overrides/mdadm
@@ -102,7 +102,7 @@
 	dh_installcron
 	dh_installchangelogs ChangeLog
 	dh_installlogcheck
-	dh_installudev
+#	dh_installudev
 	dh_strip
 	dh_compress
 	dh_fixperms




More information about the pkg-mdadm-commits mailing list