Merge "Fixed device or resource busy issue in EXIT trap"
This commit is contained in:
commit
c79c05910c
@ -275,3 +275,12 @@ function mount_proc_dev_sys () {
|
|||||||
sudo mount -t sysfs none $TMP_MOUNT_PATH/sys
|
sudo mount -t sysfs none $TMP_MOUNT_PATH/sys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unmount_dir () {
|
||||||
|
local pattern="$1" mnts=""
|
||||||
|
if [ -n "$pattern" ]; then
|
||||||
|
mnts=`awk '{print $2}' < /proc/mounts | grep "^$pattern" | sort -r`
|
||||||
|
fi
|
||||||
|
if [ -n "$mnts" ]; then
|
||||||
|
sudo umount -fl $mnts || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@ -25,7 +25,14 @@ function fullpath() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanup () {
|
function cleanup () {
|
||||||
sudo umount -f $TMP_BUILD_DIR || true
|
unmount_dir "$TMP_BUILD_DIR/mnt"
|
||||||
|
if [ -f "$TMP_IMAGE_PATH" ]; then
|
||||||
|
loopdev=`sudo losetup -j "$TMP_IMAGE_PATH" | cut -d: -f1`
|
||||||
|
if [ -n "$loopdev" ]; then
|
||||||
|
detach_loopback "$loopdev"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unmount_dir "$TMP_BUILD_DIR"
|
||||||
rm -rf --one-file-system "$TMP_BUILD_DIR"
|
rm -rf --one-file-system "$TMP_BUILD_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user