summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2012-02-15 12:10:06 +0100
committerDaniel Baumann <daniel@debian.org>2012-04-05 07:45:47 +0200
commitbb77d0efe779cd9e2e245e7f56f3abbd2baa7d72 (patch)
tree973e1b6575a46140852a5167876ed5795a8af9de /scripts
parentad772f205c1044ce7fe5383d72aae9a3ca8f33a7 (diff)
downloadlive-boot-bb77d0efe779cd9e2e245e7f56f3abbd2baa7d72.tar.gz
live-boot-bb77d0efe779cd9e2e245e7f56f3abbd2baa7d72.zip
Check if luks device is already open before trying to open it.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/live-helpers15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/live-helpers b/scripts/live-helpers
index a69ce29..8822125 100644
--- a/scripts/live-helpers
+++ b/scripts/live-helpers
@@ -721,6 +721,21 @@ open_luks_device ()
opts="${opts} --readonly"
fi
+ if /sbin/cryptsetup status "${name}" >/dev/null 2>&1
+ then
+ re="^[[:space:]]*device:[[:space:]]*\([^[:space:]]*\)$"
+ opened_dev=$(cryptsetup status ${name} 2>/dev/null | grep "${re}" | sed "s|${re}|\1|")
+ if [ "${opened_dev}" = "${dev}" ]
+ then
+ luks_device="/dev/mapper/${name}"
+ echo ${luks_device}
+ return 0
+ else
+ log_warning_msg "Cannot open luks device ${dev} since ${opened_dev} already is opened with its name"
+ return 1
+ fi
+ fi
+
load_keymap
while true