bail out of cryptroot-ask, if we have already asked about the password
authorHarald Hoyer <harald@redhat.com>
Thu, 2 Jul 2009 09:35:01 +0000 (11:35 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 2 Jul 2009 09:47:27 +0000 (11:47 +0200)
modules.d/50plymouth/cryptroot-ask.sh
modules.d/90crypt/cryptroot-ask.sh

index 88b93c0..2d0f357 100755 (executable)
@@ -2,13 +2,20 @@
 
 # do not ask, if we already have root
 [ -f /sysroot/proc ] && exit 0
+
 # check if destination already exists
 [ -b /dev/mapper/$2 ] && exit 0
 
+# we already asked for this device
+[ -f /tmp/cryptroot-asked-$2 ] && exit 0
+
 # flock against other interactive activities
 { flock -s 9; 
 /bin/plymouth ask-for-password --prompt "$1 is password protected" --command="/sbin/cryptsetup luksOpen -T1 $1 $2"
 } 9>/.console.lock
 
+# mark device as asked
+>> /tmp/cryptroot-asked-$2
+
 exit 0
 
index 0c8a0c8..d87c2ea 100755 (executable)
@@ -1,7 +1,21 @@
 #!/bin/sh
 
+# do not ask, if we already have root
+[ -f /sysroot/proc ] && exit 0
+
+# check if destination already exists
 [ -b /dev/mapper/$2 ] && exit 0
+
+# we already asked for this device
+[ -f /tmp/cryptroot-asked-$2 ] && exit 0
+
+# flock against other interactive activities
 { flock -s 9; 
-  /sbin/cryptsetup luksOpen -T1 $1 $2 </dev/console >/dev/console 2>&1
+    echo -n "$1 is password protected " 
+    /sbin/cryptsetup luksOpen -T1 $1 $2
 } 9>/.console.lock
 
+# mark device as asked
+>> /tmp/cryptroot-asked-$2
+
+exit 0
\ No newline at end of file