aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/yardstick-img-modify6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify
index 0033383ef..1743d908a 100755
--- a/tools/yardstick-img-modify
+++ b/tools/yardstick-img-modify
@@ -152,9 +152,13 @@ cleanup() {
mount | grep $mountdir/proc && umount $mountdir/proc
mount | grep $mountdir && umount $mountdir
mount | grep "/mnt/vivid" && umount "/mnt/vivid"
+
if [ -f $raw_imgfile ]; then
- kpartx -dv $raw_imgfile
+ if [ -z "$(kpartx -l $raw_imgfile | grep 'loop deleted')" ]; then
+ kpartx -dv $raw_imgfile
+ fi
fi
+
rm -f $raw_imgfile
rm -rf $mountdir
}