From f41c17e3d07debf0c6a5f9023115561bf56a6f24 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Mon, 20 Jun 2016 11:10:58 +0200 Subject: Allow persistence and (luks) containers in subdirectories. --- liveinit | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'liveinit') 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 2>&1 + cryptsetup luksOpen $prdev $(basename ${PERSISTENCE}) /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 -- cgit v1.2.3-65-gdbad From 582579c6700ed9034b8e17c0d08d935447a661f9 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Thu, 23 Jun 2016 00:50:35 +0200 Subject: liveslak: enhance the boot debug a bit. Some explanation about what the 'debug' boot parameter does: 'debug=1' => enable some strategic pauses during boot while showing 'mount' and 'blkid' output, so you can scroll back and inspect the proceedings (just 'debug' also enables level 1). 'debug=2' => enable verbose script execution in addition to the above pause moments. 'debug=3' => verbose script execution but without the mount/blkid info during the strategically placed pauses. 'debug=4' => dumps you into a debug shell right before the switch_root. No other pauses other debugging aids are offered like with levels 1, 2 or 3. But you can check the health of your Live system before Slackware boots up. --- liveinit | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'liveinit') diff --git a/liveinit b/liveinit index d42b9ce..cbac798 100755 --- a/liveinit +++ b/liveinit @@ -220,14 +220,18 @@ for ARG in $(cat /proc/cmdline); do esac done +# Verbose boot script execution: [ $DEBUG -ge 2 ] && set -x debugit () { - [ $DEBUG -eq 0 -o $DEBUG -gt 3 ] && return - echo "DEBUG>> -- blkid info -- :" - blkid | while read LINE ; do echo "DEBUG>> $LINE" ; done - echo "DEBUG>> -- mount info -- :" - mount | while read LINE ; do echo "DEBUG>> $LINE" ; done + if [ $DEBUG -eq 0 -o $DEBUG -gt 3 ]; then + return + elif [ $DEBUG -le 2 ]; then + echo "DEBUG>> -- blkid info -- :" + blkid | while read LINE ; do echo "DEBUG>> $LINE" ; done + echo "DEBUG>> -- mount info -- :" + mount | while read LINE ; do echo "DEBUG>> $LINE" ; done + fi echo "DEBUG>> -- Press ENTER to continue -- : " read JUNK return @@ -730,6 +734,8 @@ if [ "$RESCUE" = "" ]; then fi fi + debugit + # Create the writable upper directory, plus the workdir which is required # for overlay to function (the two must be in the same POSIX filesystem): [ ! -d ${UPPERDIR} ] && mkdir -p ${UPPERDIR} -- cgit v1.2.3-65-gdbad