From 7068086c94a5c048aad19c412e31a3a56a5c8b78 Mon Sep 17 00:00:00 2001 From: Sam Tygier Date: Sat, 16 Feb 2019 12:15:25 +0000 Subject: [PATCH] Make sure unmount_image finds stale loop devices Fixes #257 #104 #193 Instead of searching by full path, which is prone to fail, read full list and grep on filename. --- scripts/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/common b/scripts/common index 9db903e..bb75a7e 100644 --- a/scripts/common +++ b/scripts/common @@ -57,7 +57,7 @@ unmount_image(){ sync sleep 1 local LOOP_DEVICES - LOOP_DEVICES=$(losetup -j "${1}" | cut -f1 -d':') + LOOP_DEVICES=$(losetup --list | grep "$(basename "${1}")" | cut -f1 -d' ') for LOOP_DEV in ${LOOP_DEVICES}; do if [ -n "${LOOP_DEV}" ]; then local MOUNTED_DIR