summaryrefslogtreecommitdiffstats
path: root/liveinit
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2016-06-20 11:10:58 +0200
committer Eric Hameleers <alien@slackware.com>2016-06-20 11:10:58 +0200
commitf41c17e3d07debf0c6a5f9023115561bf56a6f24 (patch)
tree697e7d4cc441f7f9031127aa1e473fa3a60b9038 /liveinit
parent6c5f2ee34128112eebc19306362a65f785fa95b6 (diff)
downloadliveslak-f41c17e3d07debf0c6a5f9023115561bf56a6f24.tar.gz
liveslak-f41c17e3d07debf0c6a5f9023115561bf56a6f24.tar.xz
Allow persistence and (luks) containers in subdirectories.
Diffstat (limited to '')
-rwxr-xr-xliveinit10
1 files changed, 5 insertions, 5 deletions
diff --git a/liveinit b/liveinit
index 43c8a9c..d42b9ce 100755
--- a/liveinit
+++ b/liveinit
@@ -691,19 +691,19 @@ if [ "$RESCUE" = "" ]; then
mount -o remount,rw /mnt/media
# Find a free loop device to mount the persistence container file:
prdev=$(find_loop)
- prdir=${PERSISTENCE}_$(od -An -N1 -tu1 /dev/urandom |tr -d ' ')
+ prdir=$(basename ${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
+ cryptsetup luksOpen $prdev $(basename ${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}
+ prdev=/dev/mapper/$(basename ${PERSISTENCE})
fi
fi
prfs=$(blkid $prdev |rev |cut -d'"' -f2 |rev)
@@ -714,10 +714,10 @@ if [ "$RESCUE" = "" ]; then
else
if [ "$WIPE_PERSISTENCE" = "1" ]; then
echo "${MARKER}: Wiping existing persistent data in '/${PERSISTENCE}.img'."
- find /mnt/live/${prdir}/${PERSISTENCE}/ -mindepth 1 -exec rm -rf {} \; 2>/dev/null
+ find /mnt/live/${prdir}/$(basename ${PERSISTENCE})/ -mindepth 1 -exec rm -rf {} \; 2>/dev/null
fi
echo "${MARKER}: Writing persistent changes to file '/${PERSISTENCE}.img'."
- UPPERDIR=/mnt/live/${prdir}/${PERSISTENCE}
+ UPPERDIR=/mnt/live/${prdir}/$(basename ${PERSISTENCE})
OVLWORK=/mnt/live/${prdir}/.ovlwork
fi
fi