get crypt password with rules

master
Harald Hoyer 2009-03-09 12:53:19 +01:00
parent e22d1330d1
commit ab83e0a6f5
10 changed files with 20 additions and 20 deletions

View File

@ -8,6 +8,6 @@ SUBSYSTEM!="block", GOTO="luks_end"
ACTION!="add|change", GOTO="luks_end" ACTION!="add|change", GOTO="luks_end"


KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode" 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" LABEL="luks_end"

View File

@ -1,2 +1,3 @@
#!/bin/bash #!/bin/bash
exit 1
[[ -x /sbin/plymouthd && -x /bin/plymouth ]] [[ -x /sbin/plymouthd && -x /bin/plymouth ]]

View File

@ -4,6 +4,6 @@ echo "installing plymouth"
inst_hook pre-udev 10 "$moddir"/plymouth-start.sh inst_hook pre-udev 10 "$moddir"/plymouth-start.sh
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
inst_rules "$moddir/63-luks.rules" 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 inst cryptsetup



View File

@ -8,6 +8,6 @@ SUBSYSTEM!="block", GOTO="luks_end"
ACTION!="add|change", GOTO="luks_end" ACTION!="add|change", GOTO="luks_end"


KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode" 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" LABEL="luks_end"

View File

@ -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

View File

@ -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
}

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
inst cryptsetup inst cryptsetup
inst_rules "$moddir/63-luks.rules" inst_rules "$moddir/63-luks.rules"
inst_hook mount 10 "$moddir/cryptroot.sh" inst "$moddir"/cryptroot-ask.sh /lib/udev/cryptroot-ask


View File

@ -74,7 +74,10 @@ while :; do
[ "$ROOTFS_MOUNTED" ] && break; [ "$ROOTFS_MOUNTED" ] && break;
sleep 1 sleep 1
i=$(($i+1)) i=$(($i+1))
(
flock -s 200
[ $i -gt 10 ] && emergency_shell [ $i -gt 10 ] && emergency_shell
) 200>/.console_lock
done done


# by the time we get here, the root filesystem should be mounted. # by the time we get here, the root filesystem should be mounted.

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/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 # install our scripts and hooks
inst "$moddir/init" "/init" inst "$moddir/init" "/init"
inst "$moddir/switch_root" "/sbin/switch_root" inst "$moddir/switch_root" "/sbin/switch_root"