diff --git a/modules.d/50plymouth/63-luks.rules b/modules.d/50plymouth/63-luks.rules index 5463139c..893577bb 100644 --- a/modules.d/50plymouth/63-luks.rules +++ b/modules.d/50plymouth/63-luks.rules @@ -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" diff --git a/modules.d/50plymouth/check b/modules.d/50plymouth/check index 9b828a35..06dc4927 100755 --- a/modules.d/50plymouth/check +++ b/modules.d/50plymouth/check @@ -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 ]] diff --git a/modules.d/50plymouth/plymouth-ask.sh b/modules.d/50plymouth/cryptroot-ask.sh similarity index 100% rename from modules.d/50plymouth/plymouth-ask.sh rename to modules.d/50plymouth/cryptroot-ask.sh diff --git a/modules.d/50plymouth/install b/modules.d/50plymouth/install index fb07f0de..0d284613 100755 --- a/modules.d/50plymouth/install +++ b/modules.d/50plymouth/install @@ -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 diff --git a/modules.d/90crypt/63-luks.rules b/modules.d/90crypt/63-luks.rules index 802ea062..893577bb 100644 --- a/modules.d/90crypt/63-luks.rules +++ b/modules.d/90crypt/63-luks.rules @@ -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 index 00000000..499f5869 --- /dev/null +++ b/modules.d/90crypt/cryptroot-ask.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +[ -b /dev/mapper/$2 ] && exit 0 +( + flock -s 200 + /sbin/cryptsetup luksOpen -T1 $1 $2 /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 index 86e3bbfc..00000000 --- a/modules.d/90crypt/cryptroot.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -[ -s /cryptroot ] && { - udevadm control --stop-exec-queue - while read cryptopts; do - ( exec >/dev/console 2>&1 /cryptroot - udevadm control --start-exec-queue - udevadm settle --timeout=30 -} diff --git a/modules.d/90crypt/install b/modules.d/90crypt/install index 92b51699..f733c2ac 100755 --- a/modules.d/90crypt/install +++ b/modules.d/90crypt/install @@ -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 + diff --git a/modules.d/99base/init b/modules.d/99base/init index b45bb7b1..12ca3711 100755 --- a/modules.d/99base/init +++ b/modules.d/99base/init @@ -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. diff --git a/modules.d/99base/install b/modules.d/99base/install index 922dca9d..5636b046 100755 --- a/modules.d/99base/install +++ b/modules.d/99base/install @@ -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"