From 7ac7e1135d262d344577c4cc6787aacb1d869352 Mon Sep 17 00:00:00 2001 From: "Victor \"multun\" Collod" Date: Wed, 30 Jan 2019 17:10:08 +0100 Subject: [PATCH] mountpoint: always try to unmount Previously, the previous mountpoints were all visible from the new one, which caused exponential growth of the mountpoint table (size = count ^ 2 - 1) Signed-off-by: Victor "multun" Collod --- arch-creator.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch-creator.sh b/arch-creator.sh index 82066c3..f987099 100755 --- a/arch-creator.sh +++ b/arch-creator.sh @@ -214,13 +214,14 @@ squashfs() { # directory must be already mounted before chrooting in mount_bind() { step "Mounting ROOTFS" - mount --bind ${ROOTFS_DIR} ${ROOTFS_DIR} + mount --bind "${ROOTFS_DIR}" "${ROOTFS_DIR}" + trap umount_bind EXIT unstep } umount_bind() { step "Unmounting ROOTFS" - umount ${ROOTFS_DIR} + umount "${ROOTFS_DIR}" unstep } @@ -259,7 +260,6 @@ clean() { step "Cleaning ${IMAGE_NAME}" - umount_bind run rm -rf `dirname "${ROOTFS_DIR}"` run rm -rf "${IMAGES_DIR}/${IMAGE_NAME}.squashfs" run rm -rf "${IMAGES_DIR}/${IMAGE_NAME}_*"