Skip to content

Commit

Permalink
Make sure unmount_image finds stale loop devices
Browse files Browse the repository at this point in the history
Fixes RPi-Distro#257 RPi-Distro#104 RPi-Distro#193

Instead of searching by full path, which is prone to fail, read full list and grep on filename.
  • Loading branch information
samtygier authored and fuji246 committed Sep 13, 2019
1 parent 0b165df commit dc1bf9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/common
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc1bf9f

Please sign in to comment.