Resync with Debian git
[live-initramfs-grml.git] / scripts / live-helpers
index 59bdb4f..c4fca95 100644 (file)
@@ -327,6 +327,43 @@ find_cow_device ()
                                break
                        fi
 
+                       # Checking for a luks device
+                       if [ -e /sbin/cryptsetup ] && /sbin/cryptsetup isLuks ${devname}
+                       then
+                               while true
+                               do
+                                       load_keymap
+
+                                       echo -n "Enter passphrase for ${pers_label} on ${devname}: " >&6
+                                       read -s passphrase
+                                       echo "${passphrase}" > /tmp/passphrase
+                                       unset passphrase
+                                       exec 9</tmp/passphrase
+                                       /sbin/cryptsetup luksOpen ${devname} $(basename ${devname})
+                                       error=${?}
+                                       exec 9<&-
+                                       rm -f /tmp/passphrase
+
+                                       devname="/dev/mapper/$(basename ${devname})"
+
+                                       if [ 0 -eq ${error} ]
+                                       then
+                                               unset error
+                                               break
+                                       fi
+
+                                       echo
+                                       echo -n "There was an error decrypting ${devname} ... Retry? [Y/n] " >&6
+                                       read answer
+
+                                       if [ "$(echo "${answer}" | cut -b1 | tr A-Z a-z)" = "n" ]
+                                       then
+                                               unset answer
+                                               break
+                                       fi
+                               done
+                       fi
+
                        if [ "$(/lib/udev/vol_id -l ${devname} 2>/dev/null)" = "${pers_label}" ]
                        then
                                echo "${devname}"