r98 - mdadm/trunk/debian

madduck at users.alioth.debian.org madduck at users.alioth.debian.org
Thu Aug 10 14:02:06 UTC 2006


Author: madduck
Date: 2006-08-10 14:02:03 +0000 (Thu, 10 Aug 2006)
New Revision: 98

Added:
   mdadm/trunk/debian/mdadm-name-generator.sh
Modified:
   mdadm/trunk/debian/TODO
   mdadm/trunk/debian/changelog
   mdadm/trunk/debian/mdadm-raid
   mdadm/trunk/debian/mdadm.dirs
   mdadm/trunk/debian/mdadm.postinst
   mdadm/trunk/debian/rules
Log:
readding udev, this time with a smart script

Modified: mdadm/trunk/debian/TODO
===================================================================
--- mdadm/trunk/debian/TODO	2006-08-10 11:17:28 UTC (rev 97)
+++ mdadm/trunk/debian/TODO	2006-08-10 14:02:03 UTC (rev 98)
@@ -4,5 +4,11 @@
 - 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$

Modified: mdadm/trunk/debian/changelog
===================================================================
--- mdadm/trunk/debian/changelog	2006-08-10 11:17:28 UTC (rev 97)
+++ mdadm/trunk/debian/changelog	2006-08-10 14:02:03 UTC (rev 98)
@@ -1,5 +1,13 @@
-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 at 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
       fixes #287415
@@ -12,7 +20,7 @@
     kernel autoassembly assembled the RAIDs (and not mdadm) and thus no device
     nodes were created (closes: #382263).
 
- -- martin f. krafft <madduck at debian.org>  Wed,  9 Aug 2006 22:25:19 +0100
+ -- martin f. krafft <madduck at debian.org>  Thu, 10 Aug 2006 14:56:47 +0100
 
 mdadm (2.5.2-10) unstable; urgency=low
 

Added: mdadm/trunk/debian/mdadm-name-generator.sh
===================================================================
--- mdadm/trunk/debian/mdadm-name-generator.sh	2006-08-10 11:17:28 UTC (rev 97)
+++ mdadm/trunk/debian/mdadm-name-generator.sh	2006-08-10 14:02:03 UTC (rev 98)
@@ -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 at 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

Modified: mdadm/trunk/debian/mdadm-raid
===================================================================
--- mdadm/trunk/debian/mdadm-raid	2006-08-10 11:17:28 UTC (rev 97)
+++ mdadm/trunk/debian/mdadm-raid	2006-08-10 14:02:03 UTC (rev 98)
@@ -195,12 +195,12 @@
     fi
     ;;
 
-  restart)
+  restart|force-reload)
     ${0:-} stop
     ${0:-} start
     ;;
 
-  reload|force-reload)
+  reload)
     PREFIX="Reloading RAID array"
     log_notice "never anything to do"
     ;;

Modified: mdadm/trunk/debian/mdadm.dirs
===================================================================
--- mdadm/trunk/debian/mdadm.dirs	2006-08-10 11:17:28 UTC (rev 97)
+++ mdadm/trunk/debian/mdadm.dirs	2006-08-10 14:02:03 UTC (rev 98)
@@ -5,3 +5,4 @@
 usr/share/initramfs-tools/scripts/local-top
 usr/share/bug/mdadm
 usr/share/lintian/overrides
+etc/udev/scripts

Modified: mdadm/trunk/debian/mdadm.postinst
===================================================================
--- mdadm/trunk/debian/mdadm.postinst	2006-08-10 11:17:28 UTC (rev 97)
+++ mdadm/trunk/debian/mdadm.postinst	2006-08-10 14:02:03 UTC (rev 98)
@@ -129,7 +129,7 @@
 
 # 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 @@
 #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

Modified: mdadm/trunk/debian/rules
===================================================================
--- mdadm/trunk/debian/rules	2006-08-10 11:17:28 UTC (rev 97)
+++ mdadm/trunk/debian/rules	2006-08-10 14:02:03 UTC (rev 98)
@@ -83,6 +83,8 @@
 	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 @@
 	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