exit if getting the IMG format failed

This commit is contained in:
Ilfat G 2022-11-23 19:55:34 +03:00
parent 4cef7b590f
commit 4a245d78a1
No known key found for this signature in database
GPG key ID: D5E884CA11E29755
2 changed files with 5 additions and 2 deletions

5
qemoo
View file

@ -166,7 +166,10 @@ if ! command -V "$QEMU" >/dev/null; then
exit ${LINENO}
fi
IMGFORMAT="$(qemu-img info $IMG |grep 'format:' |cut -d' ' -f3)"
set -o pipefail
IMGFORMAT="$(qemu-img info "$IMG" |grep 'format:' |cut -d' ' -f3)" || exit ${LINENO}
set +o pipefail
if [ "$LOSETUP" -a "$IMGFORMAT" = "raw" ] && echo "$IMG" |grep -qv '^/dev/'; then
LOOPDEV="$(losetup -f)"
losetup $LOOPDEV $IMG && { IMG="$LOOPDEV"; trap "losetup -d $LOOPDEV" EXIT; } || exit ${LINENO}

View file

@ -1,7 +1,7 @@
Summary: Wrapper for qemu to easy run guest machines
Name: qemoo
Version: 0.6
Release: 3
Release: 4
License: GPLv2+
Group: System/Base
Url: https://abf.io/import/qemoo