Bug#455747: udev support

Scott James Remnant scott at ubuntu.com
Tue Dec 11 17:00:23 UTC 2007


Package: devmapper
Version: 2:1.02.20-2
Severity: wishlist
Tags: patch

Please consider applying our attached patch that enables udev to know
about the devicemapper device nodes, create /dev/disk symlinks to them
and populate vol_id information so that filesystems on the devices can
be used.

This patch depends on the dmsetup "export" option filed as Debian
#434241 and the atomic device creation patch filed as Debian #455745.

-- System Information:
Debian Release: lenny/sid
  APT prefers gutsy-updates
  APT policy: (500, 'gutsy-updates'), (500, 'gutsy-security'), (500, 'gutsy')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-14-generic (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
--- devmapper-1.02.20.orig/debian/dmsetup.udev
+++ devmapper-1.02.20/debian/dmsetup.udev
@@ -0,0 +1,31 @@
+# This file causes devicemapper devices to be assigned names by udev
+# based on the name given to dmsetup.
+# See udev(8) for syntax.
+
+SUBSYSTEM!="block", GOTO="dmsetup_end"
+KERNEL!="dm-*", GOTO="dmsetup_end"
+ACTION!="add|change", GOTO="dmsetup_end"
+
+# Obtain device status
+IMPORT{program}="/sbin/dmsetup export -j%M -m%m"
+ENV{DM_NAME}!="?*", GOTO="dmsetup_end"
+
+# Make the device take the /dev/mapper name
+OPTIONS+="string_escape=none", NAME="mapper/$env{DM_NAME}"
+SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}"
+ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
+
+# Skip vol_id for suspended devices and those with empty or error tables
+ENV{DM_STATE}=="SUSPENDED", GOTO="dmsetup_end"
+ENV{DM_TARGET_TYPES}=="|*error*", GOTO="dmsetup_end"
+
+# by-uuid and by-label symlinks
+IMPORT{program}="vol_id --export $tempnode"
+OPTIONS="link_priority=-100"
+ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS="link_priority=-90"
+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="dmsetup_end"
--- devmapper-1.02.20/debian/control
+++ devmapper-1.02.20/debian/control
@@ -26,6 +27,7 @@
 Priority: required
 Architecture: any
 Depends: ${shlibs:Depends}
+Recommends: dmsetup (>= 2:1.02.08-1ubuntu2)
 Provides: libdevmapper
 Description: The Linux Kernel Device Mapper userspace library
  The Linux Kernel Device Mapper is the LVM (Linux Logical Volume Management)
@@ -44,6 +46,7 @@
 Architecture: any
 Depends: ${shlibs:Depends}
 Provides: libdevmapper1.02.1
+Recommends: dmsetup-udeb
 Description: The Linux Kernel Device Mapper userspace library
  This is a udeb, or a microdeb, for the debian-installer.
  .
--- devmapper-1.02.20/debian/rules
+++ devmapper-1.02.20/debian/rules
@@ -78,6 +80,7 @@
 clean:
 	dh_testdir
 	rm -rf $(BUILD_DIR)
+	rm -f debian/dmsetup-udeb.udev
 
 	dh_clean
 
@@ -94,6 +98,10 @@
 	rm -rf $(INSTALL_DIR)
 	$(MAKE) -C $(DIR) install DESTDIR=$(CURDIR)/$(INSTALL_DIR) LIB_VERSION=$(LIBDEVMAPPER_ABINAME)
 
+	install -d $(INSTALL_DIR)/usr/share/initramfs-tools/hooks
+	install -m 0755 debian/dmsetup.initramfs \
+		$(INSTALL_DIR)/usr/share/initramfs-tools/hooks/dmsetup
+
 	dh_install --sourcedir=$(INSTALL_DIR)
 
 install-udeb: export DH_OPTIONS = $(addprefix -p,$(PACKAGES_UDEB))
@@ -108,6 +116,8 @@
 	rm -rf $(INSTALL_DIR)
 	$(MAKE) -C $(DIR) install DESTDIR=$(CURDIR)/$(INSTALL_DIR) LIB_VERSION=$(LIBDEVMAPPER_ABINAME)
 
+	cp -a debian/dmsetup.udev debian/dmsetup-udeb.udev
+
 	dh_install --sourcedir=$(INSTALL_DIR)
 
 # Build architecture-independent files here.
@@ -119,7 +129,7 @@
 	dh_testroot -a
 	dh_installchangelogs WHATS_NEW -a
 	dh_installdocs -a
-	dh_installinit -a -- start 25 S .
+	dh_installudev -a --priority=65
 	dh_strip -a
 	dh_link -p libdevmapper-dev lib/libdevmapper.so.$(LIBDEVMAPPER_ABINAME) usr/lib/libdevmapper.so
 	dh_compress -a
--- devmapper-1.02.20.orig/debian/dmsetup.initramfs
+++ devmapper-1.02.20/debian/dmsetup.initramfs
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+# initramfs hook for dmsetup
+
+PREREQ="udev"
+
+# Output pre-requisites
+prereqs()
+{
+	echo "$PREREQ"
+}
+
+case "$1" in
+    prereqs)
+	prereqs
+	exit 0
+	;;
+esac
+
+
+. /usr/share/initramfs-tools/hook-functions
+
+copy_exec /sbin/dmsetup /sbin
+
+cp -p /etc/udev/rules.d/65-dmsetup.rules ${DESTDIR}/etc/udev/rules.d
--- devmapper-1.02.20/debian/dmsetup.install
+++ devmapper-1.02.20/debian/dmsetup.install
@@ -2,0 +3 @@
+usr/share/initramfs-tools/hooks/dmsetup
--- devmapper-1.02.20.orig/debian/dmsetup.postinst
+++ devmapper-1.02.20/debian/dmsetup.postinst
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ "$1" = "configure" ]; then
+	if type update-initramfs >/dev/null 2>&1; then
+		update-initramfs -u
+	fi
+fi
+
+#DEBHELPER#


More information about the pkg-lvm-maintainers mailing list