summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authormadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-08-10 14:02:03 +0000
committermadduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464>2006-08-10 14:02:03 +0000
commite20a680d56c0063ba4eb80bbe675b83b9b2df0ab (patch)
tree078c1c12f8a730ab2774ae16bd7849485cfc2946 /debian
parentc2a2049be3e4e752e33b013cea72e89e47deadf7 (diff)
readding udev, this time with a smart script
Diffstat (limited to 'debian')
-rw-r--r--debian/TODO6
-rw-r--r--debian/changelog12
-rw-r--r--debian/mdadm-name-generator.sh59
-rw-r--r--debian/mdadm-raid4
-rw-r--r--debian/mdadm.dirs1
-rw-r--r--debian/mdadm.postinst15
-rwxr-xr-xdebian/rules4
7 files changed, 88 insertions, 13 deletions
diff --git a/debian/TODO b/debian/TODO
index be35d773..4f3163c6 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -4,5 +4,11 @@ debian mdadm TODO list
- check whether mdadm.conf and system are consistent during initramfs creation
and fail otherwise (#381303).
- then switch to using system mdadm.conf in initramfs.
+- add debconf question to determine naming scheme. Reuse logic from udev
+ script mdadm-name-generator.sh to preseed the question, store answer in
+ /etc/default, make mdadm-name-generator.sh actually use that value. Or just
+ get rid of mdadm-name-generator.sh and move everything to debconf.config,
+ then install udev rules for each naming scheme to /usr/share/mdadm and use
+ ucf to install the appropriate one to /etc.
$Id$
diff --git a/debian/changelog b/debian/changelog
index 3a7b9c15..4a0ccb0f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,12 @@
-mdadm (2.5.3-1~unreleased.2) UNRELEASED; urgency=low
+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.
+
+ -- martin f. krafft <madduck@debian.org> Thu, 10 Aug 2006 15:00:06 +0100
+
+mdadm (2.5.3-1~unreleased.3) UNRELEASED; urgency=low
* New upstream release.
- now the --run switch behaves as stated in the manpage. This properly
@@ -12,7 +20,7 @@ mdadm (2.5.3-1~unreleased.2) UNRELEASED; urgency=low
kernel autoassembly assembled the RAIDs (and not mdadm) and thus no device
nodes were created (closes: #382263).
- -- martin f. krafft <madduck@debian.org> Wed, 9 Aug 2006 22:25:19 +0100
+ -- martin f. krafft <madduck@debian.org> Thu, 10 Aug 2006 14:56:47 +0100
mdadm (2.5.2-10) unstable; urgency=low
diff --git a/debian/mdadm-name-generator.sh b/debian/mdadm-name-generator.sh
new file mode 100644
index 00000000..bf372478
--- /dev/null
+++ b/debian/mdadm-name-generator.sh
@@ -0,0 +1,59 @@
+#!/bin/sh -eu
+#
+# mdadm-name-generator.sh -- determines the md node name to be used by udev
+#
+# This script determines which naming convention is expected for a given md
+# device name, passed in as udev kernel name (%k; e.g. md1). It will output
+# the name to use relative to /dev/.
+#
+# It currently looks at /etc/fstab, /etrc/crypttab, and the output of
+# pvdisplay (LVM). If it cannot determine the name, it falls back to the
+# default: /dev/mdX.
+#
+# Intended use is in udev rules:
+#
+# KERNEL=="md[0-9]*", PROGRAM="/etc/udev/scripts/mdadm-name-generator.sh %k", \
+# NAME="%c", SYMLINK=""
+# KERNEL=="md_d[0-9]*", PROGRAM="/etc/udev/scripts/mdadm-name-generator.sh %k", \
+# NAME="%c", SYMLINK=""
+#
+# Copyright © martin f. krafft <madduck@madduck.net>
+# distributed under the terms of the Artistic Licence 2.0
+#
+# $Id: mkconf 89 2006-08-08 09:33:05Z madduck $
+#
+
+case "$1" in
+ md*) :;;
+ '')
+ echo "E: missing device name argument." >&2
+ exit 1
+ ;;
+ *)
+ echo "E: invalid device name: $1" >&2
+ exit 2
+ ;;
+esac
+
+KNAME="$1"
+
+PVS=$(pvdisplay 2>/dev/null || :)
+
+add_file()
+{
+ [ -f "$1" ] && EXTRAFILES="${EXTRAFILES:-$EXTRAFILES }$1" || :
+}
+
+EXTRAFILES=""
+add_file /etc/fstab
+add_file /etc/crypttab
+
+DEVFS_KNAME="${KNAME#md}"; DEVFS_KNAME="${DEVFS_KNAME#_}"
+if echo $PVS | eval grep -q "/dev/md/$DEVFS_KNAME" - "$EXTRAFILES"; then
+ # devfs-style naming expected
+ echo "md/${DEVFS_KNAME}"
+ exit 0
+fi
+
+echo "$KNAME"
+exit 0
diff --git a/debian/mdadm-raid b/debian/mdadm-raid
index d8c6e562..421d5220 100644
--- a/debian/mdadm-raid
+++ b/debian/mdadm-raid
@@ -195,12 +195,12 @@ case "${1:-}" in
fi
;;
- restart)
+ restart|force-reload)
${0:-} stop
${0:-} start
;;
- reload|force-reload)
+ reload)
PREFIX="Reloading RAID array"
log_notice "never anything to do"
;;
diff --git a/debian/mdadm.dirs b/debian/mdadm.dirs
index 0a7797d6..00ab9ffa 100644
--- a/debian/mdadm.dirs
+++ b/debian/mdadm.dirs
@@ -5,3 +5,4 @@ usr/share/initramfs-tools/hooks
usr/share/initramfs-tools/scripts/local-top
usr/share/bug/mdadm
usr/share/lintian/overrides
+etc/udev/scripts
diff --git a/debian/mdadm.postinst b/debian/mdadm.postinst
index e205a8bb..396892df 100644
--- a/debian/mdadm.postinst
+++ b/debian/mdadm.postinst
@@ -129,7 +129,7 @@ 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 [ "${1:-}" = "configure" ] && [ "${2:-}" = "2.5.2-10" ]; then
+if false && [ "${1:-}" = "configure" ] && [ "${2:-}" = "2.5.2-10" ]; then
# first, disable the rules
rm -f /etc/udev/rules.d/z60_mdadm.rules
@@ -162,11 +162,10 @@ fi
#see 2.5.3-1 changelog why this is commented out.
# install udev symlink if it's not already there and we're being upgraded,
# see #359614
-#V=2.5.2-10
-#F=/etc/udev/rules.d/z60_mdadm.rules
-#if [ "${1:-}" = "configure" ] && dpkg --compare-versions "${2:-$V}" lt $V \
-# && [ ! -e $F ]; then
-#
-# ln -s ../mdadm.rules $F
-#fi
+V=2.5.3-1
+F=/etc/udev/rules.d/z60_mdadm.rules
+if [ "${1:-}" = "configure" ] && dpkg --compare-versions "${2:-$V}" lt $V \
+ && [ ! -e $F ]; then
+ ln -s ../mdadm.rules $F
+fi
diff --git a/debian/rules b/debian/rules
index 487c7f76..11d9ce41 100755
--- a/debian/rules
+++ b/debian/rules
@@ -83,6 +83,8 @@ install: build
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)/etc/udev/scripts
install -m0644 debian/mdadm.lintian-overrides \
$(DESTDIR)/usr/share/lintian/overrides/mdadm
@@ -101,7 +103,7 @@ binary-arch: build install
dh_installcron
dh_installchangelogs ChangeLog
dh_installlogcheck
- #dh_installudev
+ dh_installudev
dh_strip
dh_compress
dh_fixperms