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.
This commit is contained in:
parent
9d38bfac23
commit
7068086c94
|
@ -57,7 +57,7 @@ unmount_image(){
|
||||||
sync
|
sync
|
||||||
sleep 1
|
sleep 1
|
||||||
local LOOP_DEVICES
|
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
|
for LOOP_DEV in ${LOOP_DEVICES}; do
|
||||||
if [ -n "${LOOP_DEV}" ]; then
|
if [ -n "${LOOP_DEV}" ]; then
|
||||||
local MOUNTED_DIR
|
local MOUNTED_DIR
|
||||||
|
|
Loading…
Reference in New Issue
Block a user