diff options
| author | Tails developers <amnesia@boum.org> | 2012-02-15 12:10:06 +0100 |
|---|---|---|
| committer | Daniel Baumann <daniel@debian.org> | 2012-04-05 07:45:47 +0200 |
| commit | bb77d0efe779cd9e2e245e7f56f3abbd2baa7d72 (patch) | |
| tree | 973e1b6575a46140852a5167876ed5795a8af9de /scripts | |
| parent | ad772f205c1044ce7fe5383d72aae9a3ca8f33a7 (diff) | |
| download | live-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-helpers | 15 |
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 |
