diff options
| author | Tails developers <amnesia@boum.org> | 2012-02-14 16:48:52 +0100 |
|---|---|---|
| committer | Daniel Baumann <daniel@debian.org> | 2012-04-05 07:45:01 +0200 |
| commit | bfec46ce25357e087378ca220b852aca1bb83e09 (patch) | |
| tree | 4876409fb5bfa5c08a6fc4c12358554e0f657b1c /scripts | |
| parent | 56000a6516968b10e0d2e1937f4084938babf39f (diff) | |
| download | live-boot-bfec46ce25357e087378ca220b852aca1bb83e09.tar.gz live-boot-bfec46ce25357e087378ca220b852aca1bb83e09.zip | |
Handle already mounted devices and closing of unused luks devices better.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/live-helpers | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/scripts/live-helpers b/scripts/live-helpers index f8f635c..76b94e0 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -1162,23 +1162,38 @@ get_custom_mounts () { then continue fi + local device_name="$(basename ${device})" - local backing="${persistent_backing}/${device_name}" - mkdir -p "${backing}" - local device_fstype="$(get_fstype ${device})" - if [ -z "${PERSISTENT_READONLY}" ] + local device_used="" + # $device may already have been mounted by + # probe_for_file_name() in find_persistent_media() ... + local backing=$(where_is_mounted ${device}) + if [ -z "${backing}" ] then - device_mount_opts="rw,noatime" - else - device_mount_opts="ro,noatime" + # ... otherwise we mount it now + backing="${persistent_backing}/${device_name}" + mkdir -p "${backing}" + local device_fstype="$(get_fstype ${device})" + if [ -z "${PERSISTENT_READONLY}" ] + then + device_mount_opts="rw,noatime" + else + device_mount_opts="ro,noatime" + fi + if ! mount -t "${device_fstype}" -o "${device_mount_opts}" "${device}" "${backing}" >/dev/null 2>&1 + then + log_warning_msg "Could not mount persistent media ${device} (${device_fstype})" + fi fi - local device_used="" - mount -t "${device_fstype}" -o "${device_mount_opts}" "${device}" "${backing}" local include_list="${backing}/${persistence_list}" if [ ! -r "${include_list}" ] then - umount "${backing}" - rmdir "${backing}" + umount "${backing}" >/dev/null 2>&1 + rmdir "${backing}" >/dev/null 2>&1 + if /sbin/cryptsetup status ${device_name} >/dev/null 2>&1 + then + /sbin/cryptsetup luksClose "${device_name}" + fi continue fi |
