Skip to content

Commit

Permalink
Close unused LUKS devices in all cases.
Browse files Browse the repository at this point in the history
Previously LUKS partitions whose fs had the incorrect partition label
would be left open when using persistent-storage=partition.
  • Loading branch information
Tails developers authored and daniel-baumann committed Apr 1, 2012
1 parent 656155f commit 3b80171
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/live-helpers
Expand Up @@ -409,11 +409,11 @@ find_persistent_media ()
done
fi

overlay_on_dev=""
snapshot_on_dev=""
if echo ${PERSISTENT_STORAGE} | grep -qe "\<file\>"
then
devfstype="$(get_fstype ${dev})"
overlay_on_dev=""
snapshot_on_dev=""
backing="${persistent_backing}/$(basename ${dev})"
mkdir -p "${backing}"
if is_supported_fs ${devfstype} && try_mount "${dev}" "${backing}" "rw" "${devfstype}"
Expand Down Expand Up @@ -441,15 +441,17 @@ find_persistent_media ()
done
done
fi
if [ -z "${overlay_on_dev}" ]
if [ -z "${overlay_on_dev}" ] && [ -z "${snapshot_on_dev}" ]
then
umount ${backing} > /dev/null 2>&1 || true
if [ -z "${snapshot_on_dev}" ] && [ -n "${luks_device}" ] && /sbin/cryptsetup status "${luks_device}" 1> /dev/null
then
/sbin/cryptsetup luksClose "${luks_device}"
fi
fi
fi
if [ -z "${overlay_on_dev}" ] && [ -z "${snapshot_on_dev}" ] && \
[ -n "${luks_device}" ] && \
/sbin/cryptsetup status "${luks_device}" 1> /dev/null 2>&1
then
/sbin/cryptsetup luksClose "${luks_device}"
fi
done
}

Expand Down

0 comments on commit 3b80171

Please sign in to comment.