]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
get crypt password with rules
authorHarald Hoyer <harald@redhat.com>
Mon, 9 Mar 2009 11:53:19 +0000 (12:53 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 9 Mar 2009 12:08:12 +0000 (13:08 +0100)
modules.d/50plymouth/63-luks.rules
modules.d/50plymouth/check
modules.d/50plymouth/cryptroot-ask.sh [moved from modules.d/50plymouth/plymouth-ask.sh with 100% similarity]
modules.d/50plymouth/install
modules.d/90crypt/63-luks.rules
modules.d/90crypt/cryptroot-ask.sh [new file with mode: 0755]
modules.d/90crypt/cryptroot.sh [deleted file]
modules.d/90crypt/install
modules.d/99base/init
modules.d/99base/install

index 5463139c5619c8c612a9169b696153e84a7d3969..893577bbc6b706b89f55da00250b1f5b935a8536 100644 (file)
@@ -8,6 +8,6 @@ SUBSYSTEM!="block", GOTO="luks_end"
 ACTION!="add|change", GOTO="luks_end"
 
 KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
-ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="plymouth-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
+ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
 
 LABEL="luks_end"
index 9b828a3520001eaa915b44b525211ee9a1348ce3..06dc492736e30325d5dbf2c1fe698bb6802b822b 100755 (executable)
@@ -1,2 +1,3 @@
 #!/bin/bash
-[[ -x /sbin/plymouthd && -x /bin/plymouth ]]
\ No newline at end of file
+exit 1
+[[ -x /sbin/plymouthd && -x /bin/plymouth ]]
index fb07f0de83302d172dfdfa1cb1979390c738fa33..0d2846137a778f9313c5eb2a033e83fa95e1acf4 100755 (executable)
@@ -4,6 +4,6 @@ echo "installing plymouth"
 inst_hook pre-udev 10 "$moddir"/plymouth-start.sh
 inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
 inst_rules "$moddir/63-luks.rules"
-inst "$moddir"/plymouth-ask.sh /lib/udev/plymouth-ask
+inst "$moddir"/cryptroot-ask.sh /lib/udev/cryptroot-ask
 inst cryptsetup
 
index 802ea062ed4fd56e3559f3055f0f644c5181cee5..893577bbc6b706b89f55da00250b1f5b935a8536 100644 (file)
@@ -8,6 +8,6 @@ SUBSYSTEM!="block", GOTO="luks_end"
 ACTION!="add|change", GOTO="luks_end"
 
 KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
-ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/bin/sh -c 'echo $env{DEVNAME} luks-$env{ID_FS_UUID} >>/cryptroot'"
+ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
 
 LABEL="luks_end"
diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-ask.sh
new file mode 100755 (executable)
index 0000000..499f586
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+[ -b /dev/mapper/$2 ] && exit 0
+(
+       flock -s 200
+       /sbin/cryptsetup luksOpen -T1 $1 $2 </dev/console >/dev/console 2>&1
+) 200>/.console.lock
+
diff --git a/modules.d/90crypt/cryptroot.sh b/modules.d/90crypt/cryptroot.sh
deleted file mode 100755 (executable)
index 86e3bbf..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-[ -s /cryptroot ] && { 
-    udevadm control --stop-exec-queue
-    while read cryptopts; do
-       (   exec >/dev/console 2>&1 </dev/console
-          set $cryptopts
-          [ -b /dev/mapper/$2 ] || ( /sbin/cryptsetup luksOpen $cryptopts || emergency_shell )
-       )
-    done </cryptroot
-    >/cryptroot
-    udevadm control --start-exec-queue
-    udevadm settle --timeout=30
-}
index 92b51699518dac5ba6ee40fc9f243d3c4ca26b8e..f733c2acd6c9a2d73b78d865cb80205f7533ec35 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/bash
 inst cryptsetup
 inst_rules "$moddir/63-luks.rules"
-inst_hook mount 10 "$moddir/cryptroot.sh"
\ No newline at end of file
+inst "$moddir"/cryptroot-ask.sh /lib/udev/cryptroot-ask
+
index b45bb7b10338cc35f127679685c8b5d5d8de74a5..12ca3711a0f675b6a158acfeba0b3344144b4228 100755 (executable)
@@ -74,7 +74,10 @@ while :; do
     [ "$ROOTFS_MOUNTED" ] && break;
     sleep 1
     i=$(($i+1))
-    [ $i -gt 10 ] && emergency_shell
+    (
+       flock -s 200
+       [ $i -gt 10 ] && emergency_shell
+    ) 200>/.console_lock
 done
 
 # by the time we get here, the root filesystem should be mounted.
index 922dca9dcca4600ca3da400bc4353b47e9b4a74d..5636b0461177a7a739ee5e1d0f6b899d70a56c32 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-dracut_install mount mknod mkdir modprobe pidof sleep chroot echo sed sh ls
+dracut_install mount mknod mkdir modprobe pidof sleep chroot echo sed sh ls flock
 # install our scripts and hooks
 inst "$moddir/init" "/init"
 inst "$moddir/switch_root" "/sbin/switch_root"