diff -ur a/usr/share/initramfs-tools/hooks/cryptroot b/usr/share/initramfs-tools/hooks/cryptroot --- a/usr/share/initramfs-tools/hooks/cryptroot 2008-04-11 19:17:43.000000000 +0200 +++ b/usr/share/initramfs-tools/hooks/cryptroot 2008-06-04 13:54:48.000000000 +0200 @@ -72,6 +72,14 @@ fi fi + # Unlock all crypted partitions + if [ -e /etc/crypttab ]; then + device=$(sed -rn 's/^/\/dev\/mapper\//;s/[[:space:]].*// p' /etc/crypttab) + if [ -n "$device" ]; then + candidates="$candidates $device" + fi + fi + # Now check the sanity of all candidates devices="" count=0 @@ -417,6 +425,7 @@ # Prepare the initramfs copy_exec /sbin/cryptsetup /sbin copy_exec /sbin/dmsetup /sbin +copy_exec /bin/stty /bin # Done exit 0 diff -ur a/usr/share/initramfs-tools/scripts/local-top/cryptroot b/usr/share/initramfs-tools/scripts/local-top/cryptroot --- a/usr/share/initramfs-tools/scripts/local-top/cryptroot 2008-04-11 19:17:43.000000000 +0200 +++ b/usr/share/initramfs-tools/scripts/local-top/cryptroot 2008-06-04 14:17:32.000000000 +0200 @@ -190,15 +190,28 @@ crypttarget="$crypttarget" cryptsource="$cryptsource" \ $cryptkeyscript $cryptkey < /dev/console 2> /dev/console | \ $cryptcreate --key-file=- > /dev/console 2>&1 + elif [ -n "$PASS" ]; then + # Unlock with previous password + echo "Unlocking the disk ($crypttarget) using the same password" + count=0 + echo -n "$PASS" | $cryptcreate > /dev/console 2>&1 elif [ -p /dev/.initramfs/usplash_outfifo ] && [ -x /sbin/usplash_write ]; then usplash_write "INPUTQUIET Enter password to unlock the disk ($crypttarget): " PASS="$(cat /dev/.initramfs/usplash_outfifo)" echo -n "$PASS" | $cryptcreate > /dev/null 2>&1 + elif [ $count -lt 3 ] && [ -x "/bin/stty" ]; then + # Try to keep same password for other disks + echo -n "Enter password to unlock the disk ($crypttarget): " + /bin/stty --file=/dev/console -echo + read PASS < /dev/console; echo + /bin/stty --file=/dev/console echo + echo -n "$PASS" | $cryptcreate > /dev/console 2>&1 else $cryptcreate < /dev/console > /dev/console 2>&1 fi if [ $? -ne 0 ]; then + unset PASS echo "cryptsetup: cryptsetup failed, bad password or options?" sleep 3 continue