- if ! is_gpt_device ${dev} || \
- ( echo ${PERSISTENT_ENCRYPTION} | grep -qve "\<luks\>" && \
- /sbin/cryptsetup isLuks ${dev} > /dev/null 2>&1 )
+ local gpt_dev="${dev}"
+ if is_active_luks_mapping ${dev}
+ then
+ # if $dev is an opened luks device, we need to check
+ # GPT stuff on the backing device
+ gpt_dev=$(get_luks_backing_device "${dev}")
+ fi
+
+ if ! is_gpt_device ${gpt_dev}
local luks_device=""
# Check if it's a luks device; we'll have to open the device
# in order to probe any filesystem it contains, like we do
# below. do_custom_mounts() also depends on that any luks
# device already has been opened.
if echo ${PERSISTENT_ENCRYPTION} | grep -qe "\<luks\>" && \
local luks_device=""
# Check if it's a luks device; we'll have to open the device
# in order to probe any filesystem it contains, like we do
# below. do_custom_mounts() also depends on that any luks
# device already has been opened.
if echo ${PERSISTENT_ENCRYPTION} | grep -qe "\<luks\>" && \
# Probe for matching GPT partition names or filesystem labels
if echo ${PERSISTENT_STORAGE} | grep -qe "\<filesystem\>"
then
# Probe for matching GPT partition names or filesystem labels
if echo ${PERSISTENT_STORAGE} | grep -qe "\<filesystem\>"
then
- local gpt_dev="${dev}"
- if [ -n "${luks_device}" ]
- then
- # When we probe GPT partitions we need to look
- # at the real device, not the virtual, opened
- # luks device
- gpt_dev="${real_dev}"
- fi
- result=$(probe_for_gpt_name "${overlays}" "${snapshots}" ${gpt_dev})
+ result=$(probe_for_gpt_name "${overlays}" "${snapshots}" ${dev})
+is_active_luks_mapping ()
+{
+ device="${1}"
+ /sbin/cryptsetup status "${device}" 1>/dev/null 2>&1
+}
+
+get_luks_backing_device () {
+ device=${1}
+ cryptsetup status ${device} 2> /dev/null | \
+ awk '{if ($1 == "device:") print $2}'
# Side-effect: leaves $devices with live.persist mounted in ${rootmnt}/live/persistent
# Side-effect: prints info to file $custom_mounts
# Side-effect: leaves $devices with live.persist mounted in ${rootmnt}/live/persistent
# Side-effect: prints info to file $custom_mounts
- # mounting on / or /live could cause trouble
- log_warning_msg "Skipping unsafe custom mount on ${dest}"
+ log_warning_msg "Skipping unsafe custom mount with desination ${dest}: the destination must be an absolute path containing neither \".\" nor \"..\", and cannot be /live (or any sub-directory therein) or / (for the latter, use ${root_overlay_label}-type persistence instead)"
- local full_source="$(echo ${backing}/${source}/ | sed -e 's|/\+|/|g')"
- local full_dest="$(echo ${rootmnt}/${dest}/ | sed -e 's|/\+|/|g')"
+ local full_source="$(trim_path ${backing}/${source})"
+ local full_dest="$(trim_path ${rootmnt}/${dest})"
# FIXME: this should really be handled by
# live-config since we don't know for sure
# which uid a certain user has until then
# FIXME: this should really be handled by
# live-config since we don't know for sure
# which uid a certain user has until then