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

Bug#392080: Swap check fails for swap-on-LVM-on-crypto



tags 392080 patch
thanks

Hi,

Attached is a sort of tested patch for this. It works for me, but it
tries to do more that I can test.

dmsetup deps returns a list of dependencies, this attempts to break them
apart and check each in turn. I'm not sure that this is the correct
approach.

It allows me to configure in the LVM on crypt case that the auto
installer creates (as long as I didn't make a transcription error).

Apologies for the ugly code,

James

-- 
  James Westby   --    GPG Key ID: B577FE13    --     http://jameswestby.net/
  seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256
Index: crypto_tools.sh
===================================================================
--- crypto_tools.sh	(revision 41497)
+++ crypto_tools.sh	(working copy)
@@ -9,6 +9,19 @@
 		if [ "$type" = crypt ]; then
 			return 0
 		fi
+
+		rawdeps=$(/sbin/dmsetup deps $1)
+		if [ $? = 0 ]; then
+			deps=$(echo $rawdeps | sed -e's/.*: //; s/(//g; s/) /\n/g; s/)//; s/, /,/g')
+			for dep in $deps; do
+				major=$(echo $dep | cut -d "," -f 1)
+				minor=$(echo $dep | cut -d "," -f 2)
+				type=$(/sbin/dmsetup table -j $major -m $minor | head -n 1 | cut -d " " -f3)
+				if [ $type = crypt ]; then
+					return 0
+				fi
+			done
+		fi
 	fi
 	return 1
 }

Attachment: signature.asc
Description: Digital signature


Reply to: