Bug#358452: [Pkg-cryptsetup-devel] Bug#358452: initramfs cryptroot functionality

Riku Voipio riku.voipio at iki.fi
Mon May 8 21:08:14 UTC 2006


On Sun, May 07, 2006 at 11:33:48PM +0200, Jonas Meurer wrote:
> > If you remove cipher and hash arguments from /etc/crypttab, the
> > initramfs hook script will not copy the cipher and hash kernel 
> > modules to initramfs. That is what my patch fixes.
 
> which patch do you mean here? can you resend it to me?

It seems I only thought I had sent it, sorry. Incidentally it was
also ugly, here is a cleaned up version. This time I'm using the
same code David did for lvm.
-------------- next part --------------
Index: initramfs-cryptroot-hook
===================================================================
--- initramfs-cryptroot-hook	(revision 175)
+++ initramfs-cryptroot-hook	(working copy)
@@ -43,8 +43,9 @@
 }
 
 get_root_modules() {
-	local rootopts
+	local rootopts rootnode
 	rootopts=$1
+	rootnode=$2
 
 	[ ! -z $rootopts ] || return
 
@@ -65,6 +66,16 @@
 		[ ! -z $hash -o $hash != $value ] || continue
 		echo $hash
 	done
+	
+	local luksdesc lukscipher lukshash
+	luksdesc=$( dmsetup table $rootnode | cut -d " " -f4 )
+	lukscipher=$( echo $luksdesc | cut -d ":" -f1 | cut -d "-" -f1 )
+	luksivhash=$( echo $luksdesc | cut -d ":" -s -f2 )
+	[ ! -z "$lukscipher" ] || return 1
+	echo $lukscipher
+	[ ! -z "$luksivhash" ] && echo "$luksivhash"
+
+	return 0
 }
 
 get_root_initramfsopts() {
@@ -109,7 +120,7 @@
 [ ! -z $rootopts ] || exit 0
 
 # Calculate needed modules
-modules=$(get_root_modules $rootopts | sort | uniq)
+modules=$(get_root_modules $rootopts $node | sort | uniq)
 for x in $modules; do
 	force_load ${x}
 done


More information about the Pkg-cryptsetup-devel mailing list