martin f. krafft: Drop our own udev rules in favour of upstream's

Martin F. Krafft madduck at alioth.debian.org
Thu May 7 12:11:48 UTC 2009


Module: mdadm
Branch: debian/experimental
Commit: ae5144740b7ad4bdd906b0ab0ab67868b5062525
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=ae5144740b7ad4bdd906b0ab0ab67868b5062525

Author: martin f. krafft <madduck at debian.org>
Date:   Tue May  5 13:34:34 2009 +0200

Drop our own udev rules in favour of upstream's

If /etc/udev/rules.d/65_mdadm.vol_id.rules has not been modified (md5sum
check), it is automatically removed; else, a warning is emitted.

---

 debian/changelog         |    3 +++
 debian/mdadm.preinst     |   22 ++++++++++++++++++++++
 debian/mdadm.vol_id.udev |   26 --------------------------
 debian/rules             |    1 -
 4 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0c70c1e..b147660 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
 mdadm (3.0~devel3-43-g2800528-1) experimental; urgency=low
 
   * Merge tip of upstream's devel-3.0 branch at commit 800528.
+  * Drop our own udev rules in favour of upstream's. If
+    /etc/udev/rules.d/65_mdadm.vol_id.rules has not been modified (md5sum
+    check), it is automatically removed; else, a warning is emitted.
 
  -- martin f. krafft <madduck at debian.org>  Tue, 05 May 2009 12:02:03 +0200
 
diff --git a/debian/mdadm.preinst b/debian/mdadm.preinst
index 81dea70..573bba0 100644
--- a/debian/mdadm.preinst
+++ b/debian/mdadm.preinst
@@ -4,6 +4,26 @@
 #
 set -eu
 
+# based on idea from http://www.dpkg.org/dpkg/ConffileHandling
+rm_conffile() {
+    local conffile md5sum package old_md5sum
+
+    conffile="$1"
+    if [ -e "$conffile" ]; then
+        md5sum=$(md5sum "$conffile" | cut -d' ' -f1)
+        package=$(dpkg -S "$conffile" | cut -d: -f1)
+        old_md5sum=$(dpkg -s $package | sed -rne "s,[[:space:]]+${conffile}[[:space:]]+,,p")
+        if [ "$md5sum" != "$old_md5sum" ]; then
+            echo "Obsolete conffile $conffile has been modified by you."
+            echo "Saving as ${conffile}.dpkg-bak ..."
+            mv -f "$conffile" "$conffile".dpkg-bak
+        else
+            echo "Removing obsolete conffile $conffile ..."
+            rm -f "$conffile"
+        fi
+    fi
+}
+
 case "$1" in
 
   upgrade|install)
@@ -22,6 +42,8 @@ case "$1" in
       echo DEVICE partitions > /var/backups/mdadm-Es_v1.dump
       $MDADM -Esc /var/backups/mdadm-Es_v1.dump >> /var/backups/mdadm-Es_v1.dump || :
     fi
+
+    rm_conffile /etc/udev/rules.d/65_mdadm.vol_id.rules
     ;;
 
   *) :;;
diff --git a/debian/mdadm.vol_id.udev b/debian/mdadm.vol_id.udev
deleted file mode 100644
index bd67d1f..0000000
--- a/debian/mdadm.vol_id.udev
+++ /dev/null
@@ -1,26 +0,0 @@
-# This file causes Linux RAID (md) block devices to be checked for further
-# filesystems if the array is active. See udev(8) for syntax.
-#
-# Based on Suse's udev rule file for md
-
-SUBSYSTEM!="block", GOTO="mdadm_end"
-KERNEL!="md[0-9]*", GOTO="mdadm_end"
-ACTION!="add|change", GOTO="mdadm_end"
-
-# Check array status
-ATTR{md/array_state}=="|clear|inactive", GOTO="mdadm_end"
-
-# Obtain array information
-IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
-ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}"
-ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
-
-# by-uuid and by-label symlinks
-IMPORT{program}="vol_id --export $tempnode"
-OPTIONS="link_priority=100"
-ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", \
-                       SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
-ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", \
-                       SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
-
-LABEL="mdadm_end"
diff --git a/debian/rules b/debian/rules
index 5f3df09..31dbfa9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -91,7 +91,6 @@ binary-arch: build install
 	dh_installexamples debian/newdisk
 	dh_installinit --init-script=mdadm-raid --no-start -- start 25 S . start 60 0 6 .
 	dh_installinit -- defaults 25
-	dh_installudev --priority=65 --name=vol_id
 	dh_installman
 	dh_installcron
 	dh_installchangelogs ChangeLog




More information about the pkg-mdadm-commits mailing list