]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
Try to activate luks only if not yet active (because cryptsetup is run twice).
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 17 Feb 2011 21:37:19 +0000 (21:37 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 17 Feb 2011 21:37:19 +0000 (21:37 +0000)
svn-id: @12157

mod-luks.sh

index abd175d9d3aa3a4d8ff5fe7274151caf468674e3..9c8f0920dd823fa4bf16b3aec43c0723469a1995 100644 (file)
@@ -151,8 +151,15 @@ luks_crypttab() {
 
                        debug "+ cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst'"
                        add_linuxrc <<-EOF
+                       # cryptsetup can be called twice and in case on crypt on lvm only second
+                       # will succeed because there will be no src device in first cryptsetup call
+                       # this can be called multiple times, before lvm and after lvm.
                        if [ -e "$src" ]; then
-                               cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst' <&1
+                               crypt_status=\$(cryptsetup status '$dst')
+                               if [ "\${crypt_status%%is inactive.}" != "\$crypt_status" ]; then
+                                       # is inactive
+                                       cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst' <&1
+                               fi
                        fi
 
                        debugshell
This page took 0.161894 seconds and 4 git commands to generate.