summaryrefslogtreecommitdiff
path: root/debian/mdadm.postinst
diff options
context:
space:
mode:
authormadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-08-20 21:44:51 +0000
committermadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-08-20 21:44:51 +0000
commita1c12c59399daab8a78cb145d1c2c0d0b0664ba9 (patch)
tree901f2f7d99c6c4824ba39c14ada9598cfd6a80b5 /debian/mdadm.postinst
parentf99acd60de30e4228dd452ce93b253e760f76719 (diff)
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).
Diffstat (limited to 'debian/mdadm.postinst')
-rw-r--r--debian/mdadm.postinst152
1 files changed, 75 insertions, 77 deletions
diff --git a/debian/mdadm.postinst b/debian/mdadm.postinst
index 8e1841f4..931c1484 100644
--- a/debian/mdadm.postinst
+++ b/debian/mdadm.postinst
@@ -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
+
+ 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
- if [ ! -e /dev/md15 ] \
- && [ ! -e /dev/.static/dev/md15 ] \
- && [ ! -e /dev/.devfsd ]; then
+ DEBIANCONFIG=/etc/default/mdadm
+ CONFIG=/etc/mdadm/mdadm.conf
+ ALTCONFIG=/etc/mdadm.conf
+ MDADM=/sbin/mdadm
- echo -n 'Generating array device nodes... ' >&2
- cd /dev
- if /sbin/MAKEDEV md >&2 >/dev/null; then
- echo 'done.' >&2
+ 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
+
+ [ ! -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.' >&2
+ echo "failed (/proc probably not mounted)." >&2
+ rm -f $CONFIG
fi
- fi
-
- 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 [ ! -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
+ 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}"
- cat <<_eof > $DEBIANCONFIG
+ 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
# mdadm Debian configuration
#
# You can run 'dpkg-reconfigure mdadm' to modify the values in this file, if
@@ -99,7 +96,7 @@ AUTOSTART=$AUTOSTART
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 @@ START_DAEMON=$START_DAEMON
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
+ ;;
+esac
- command -v update-initramfs >/dev/null && update-initramfs -u -k all
+# 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 @@ if [ -x /etc/init.d/mdadm-raid ]; then
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