diff options
Diffstat (limited to 'liveinit')
-rwxr-xr-x | liveinit | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -446,8 +446,20 @@ if [ "$RESCUE" = "" ]; then prdir=${PERSISTENCE}_$(od -An -N1 -tu1 /dev/urandom |tr -d ' ') mkdir -p /mnt/live/${prdir} losetup $prdev /mnt/media/${PERSISTENCE}.img + # Check if the persistence container is LUKS encrypted: + if cryptsetup isLuks $prdev 1>/dev/null 2>/dev/null ; then + echo "Unlocking LUKS encrypted persistence file '/${PERSISTENCE}.img'" + cryptsetup luksOpen $prdev ${PERSISTENCE} </dev/tty0 >/dev/tty0 2>&1 + if [ $? -ne 0 ]; then + echo "${MARKER}: Failed to unlock persistence file '/${PERSISTENCE}.img'." + echo "${MARKER}: Falling back to RAM." + else + # LUKS properly unlocked; from now on use the mapper device instead: + prdev=/dev/mapper/${PERSISTENCE} + fi + fi prfs=$(blkid $prdev |rev |cut -d'"' -f2 |rev) - mount -t $prfs $prdev /mnt/live/${prdir} + mount -t $prfs $prdev /mnt/live/${prdir} 2>/dev/null if [ $? -ne 0 ]; then echo "${MARKER}: Failed to mount persistence file '/${PERSISTENCE}.img'." echo "${MARKER}: Falling back to RAM." @@ -490,9 +502,11 @@ if [ "$RESCUE" = "" ]; then mkdir -p /mnt/overlay/mnt/live mount --bind /mnt/live /mnt/overlay/mnt/live - # Same for the Linux filesystem on the USB stick: - mkdir -p /mnt/overlay/mnt/livemedia - mount --bind /mnt/media /mnt/overlay/mnt/livemedia + if [ $TORAM -eq 0 ]; then + # Same for the Linux filesystem on the USB stick: + mkdir -p /mnt/overlay/mnt/livemedia + mount --bind /mnt/media /mnt/overlay/mnt/livemedia + fi if [ ! -z "$USE_SWAP" ]; then # Use any available swap device: |