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.
pull/258/head
Sam Tygier 2019-02-16 12:15:25 +00:00
parent 3961bff8a4
commit 4a7282f953
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,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