Modified cleanup

This commit is contained in:
framp 2018-03-24 12:01:59 +01:00
parent 3dbbbd6df6
commit 8aae06a4b2
1 changed files with 3 additions and 1 deletions

View File

@ -1,7 +1,9 @@
#!/bin/bash
function cleanup() {
[[ -n $loopback ]] && losetup -d "$loopback"
if losetup $loopback &>/dev/null; then
losetup -d "$loopback"
fi
}
usage() { echo "Usage: $0 [-s] imagefile.img [newimagefile.img]"; exit -1; }