[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#365747: Add crypto nodes as well

On Thu, May 11, 2006 at 05:18:13PM +0200, Frans Pop wrote:
On Thursday 11 May 2006 01:10, David Härdeman wrote:
Something like the attached patch should suffice. Is it acceptable?

Is it a specific set of devices you need or do they vary depending on the crypto method used or number of encrypted partitions?

I think using mknod would be preferred over just copying the devices.

Is there any way you can detect whether crypto is in use (from /proc or something) and create the devices using mknod?

I intend to upload base-installer with the changes needed for partman crypto after this is settled.

Ok, here's a new version which uses mknod and only creates the node on which root resides (if any).

Index: debian/postinst
--- debian/postinst	(revision 37285)
+++ debian/postinst	(working copy)
@@ -330,6 +330,16 @@
 			major=$(grep "[0-9] misc$" /proc/devices | sed 's/[ ]\+misc//')
 			minor=$(grep "[0-9] device-mapper$" /proc/misc | sed 's/[ ]\+device-mapper//')
 			mknod /target/dev/mapper/control c $major $minor
+			# check if root is on a dm-crypt device
+			rootdev=$(mount | grep "on /target " | cut -d' ' -f1)
+			rootnode=${rootdev#/dev/mapper/}
+			if [ $rootdev != $rootnode ] && \
+			   [ $(dmsetup table $rootnode | cut -d' ' -f3) = crypt ]; then
+				major=$(dmsetup -c --noheadings info $rootnode | cut -d':' -f2)
+				minor=$(dmsetup -c --noheadings info $rootnode | cut -d':' -f3)
+				mknod /target/dev/mapper/$rootnode b $major $minor
+			fi
 		if pvdisplay | grep -iq "physical volume ---"; then
 			apt-install lvm2

Reply to: