From d973142642faad44e38c12c71cac8cc6a6c71ff8 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Thu, 18 Apr 2024 21:53:17 +0200 Subject: Try to get rid of un-removable /mnt/slackwarelive_mount_* directories .... when called by the create_liveslak_iso.sh script. --- make_slackware_live.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/make_slackware_live.sh b/make_slackware_live.sh index 6611e4f..e91f1a4 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -358,9 +358,9 @@ function cleanup() { umount ${LIVE_ROOTDIR}/sys 2>${DBGOUT} || true umount ${LIVE_ROOTDIR}/proc 2>${DBGOUT} || true umount ${LIVE_ROOTDIR}/dev 2>${DBGOUT} || true - umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true + umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true # Need to umount the squashfs modules too: - umount ${LIVE_WORK}/*_$$ 2>${DBGOUT} || true + umount -R ${LIVE_WORK}/*_$$ 2>${DBGOUT} || true rmdir ${LIVE_ROOTDIR} 2>${DBGOUT} rmdir ${LIVE_WORK}/*_$$ 2>${DBGOUT} @@ -1604,7 +1604,7 @@ fi if [ "$FORCE" = "YES" ]; then echo "-- Removing old files and directories!" umount ${LIVE_ROOTDIR}/{proc,sys,dev} 2>${DBGOUT} || true - umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true + umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true rm -rf ${LIVE_STAGING}/${LIVEMAIN} ${LIVE_WORK} ${LIVE_ROOTDIR} fi @@ -1708,12 +1708,12 @@ for SPS in ${SL_SERIES} ; do echo "${THEDATE} (${BUILDER})" > ${INSTDIR}/${MARKER} echo "-- Installing the '${SPS}' series." - umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true + umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true mount -t overlay -o lowerdir=${RODIRS},upperdir=${INSTDIR},workdir=${LIVE_OVLDIR} overlay ${LIVE_ROOTDIR} # Install the package series: install_pkgs ${SPS} ${LIVE_ROOTDIR} ${MTYPE} - umount ${LIVE_ROOTDIR} || true + umount -R ${LIVE_ROOTDIR} || true if [ "$SPS" = "a" -a "$CORE2RAM" = "NO" ] || [ "$SPS" = "${MINLIST}" ]; then @@ -1782,7 +1782,7 @@ mkdir -p ${INSTDIR} echo "-- Configuring the base system." # -------------------------------------------------------------------------- # -umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true +umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true mount -t overlay -o lowerdir=${RODIRS},upperdir=${INSTDIR},workdir=${LIVE_OVLDIR} overlay ${LIVE_ROOTDIR} # Determine the kernel version in the Live OS: @@ -3359,6 +3359,10 @@ if [ -x ${LIVE_ROOTDIR}/etc/cron.daily/mlocate ]; then else LOCATE_BIN=slocate fi +# Mlocate needs a mounted /proc in the chroot: +if ! mount | grep -q 'on ${LIVE_ROOTDIR}/proc' ; then + mount --bind /proc ${LIVE_ROOTDIR}/proc +fi chroot ${LIVE_ROOTDIR} /etc/cron.daily/${LOCATE_BIN} 2>${DBGOUT} # ----------------------------------------------------------------------------- @@ -3366,7 +3370,7 @@ chroot ${LIVE_ROOTDIR} /etc/cron.daily/${LOCATE_BIN} 2>${DBGOUT} # ----------------------------------------------------------------------------- # Squash the configuration into its own module: -umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true +umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true mksquashfs ${INSTDIR} ${LIVE_MOD_SYS}/0099-${DISTRO}_zzzconf-${SL_VERSION}-${SL_ARCH}.sxz -noappend -comp ${SQ_COMP} ${SQ_COMP_PARAMS} rm -rf ${INSTDIR}/* @@ -3386,7 +3390,7 @@ unset INSTDIR # ----------------------------------------------------------------------------- echo "-- Preparing the system for live booting." -umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true +umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true mount -t overlay -o lowerdir=${RODIRS%:*},upperdir=${LIVE_BOOT},workdir=${LIVE_OVLDIR} overlay ${LIVE_ROOTDIR} mount --bind /proc ${LIVE_ROOTDIR}/proc @@ -3496,7 +3500,7 @@ rm -rf ${LIVE_ROOTDIR}/boot/initrd-tree # ... and cleanup these mounts again: umount ${LIVE_ROOTDIR}/{proc,sys,dev} || true -umount ${LIVE_ROOTDIR} || true +umount -R ${LIVE_ROOTDIR} || true # Paranoia: [ ! -z "${LIVE_BOOT}" ] && rm -rf ${LIVE_BOOT}/{etc,tmp,usr,var} 1>${DBGOUT} 2>${DBGOUT} -- cgit v1.2.3