commit: d4ebafe44dc67c631d61509b61064895afb7312d
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 14:37:27 2024 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 14:37:27 2024 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d4ebafe4
Dont try to remove nbd that wasnt set up by us
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
targets/support/create-qcow2.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index fcf93d34..2d100b80 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -37,7 +37,8 @@ myqcow2="${1}"
modprobe -q nbd
mydevice=/dev/nbd0
-# This script requires slightly more stringent cleanup in case of errors...
+# This script requires slightly more stringent cleanup in case of errors
+# from the moment on when the nbd was set up...
qcow2die() {
echo "Something went wrong. Cleaning up..."
# here we just ignore errors
@@ -49,10 +50,10 @@ qcow2die() {
}
echo "Creating a new qcow2 disk image file ${myqcow2}.tmp.qcow2 with size
${clst_qcow2_size/%iB/}"
-qemu-img create -f qcow2 "${myqcow2}.tmp.qcow2" ${clst_qcow2_size/%iB/} ||
qcow2die "Cannot create qcow2 file"
+qemu-img create -f qcow2 "${myqcow2}.tmp.qcow2" ${clst_qcow2_size/%iB/} || die
"Cannot create qcow2 file"
echo "Connecting the qcow2 file to network block device ${mydevice}"
-qemu-nbd -c ${mydevice} -f qcow2 "${myqcow2}.tmp.qcow2" || qcow2die "Cannot
connect qcow2 file to nbd0"
+qemu-nbd -c ${mydevice} -f qcow2 "${myqcow2}.tmp.qcow2" || die "Cannot connect
qcow2 file to nbd0"
echo "Creating a GPT disklabel"
parted -s ${mydevice} mklabel gpt || qcow2die "Cannot create disklabel"