summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/debvm-run17
1 files changed, 11 insertions, 6 deletions
diff --git a/bin/debvm-run b/bin/debvm-run
index 10e19be..0c4ad2e 100755
--- a/bin/debvm-run
+++ b/bin/debvm-run
@@ -104,6 +104,13 @@ die() {
echo "$*" 1>&2
exit 1
}
+with_set_ex() {
+ local ret
+ echo "+ $*" 1>&2
+ ret=0
+ "$@" || ret=$?
+ test "$ret" = 0 || die "failed with exit code $ret"
+}
usage() {
die "usage: $0 [-g] [-i image] [-s sshport] [-- qemu options]"
}
@@ -203,6 +210,9 @@ INITRDNAME=$(/sbin/debugfs "$IMAGE" -R "stat ${BOOTDIR}initrd.img" | sed 's/Fast
test -n "$INITRDNAME" || die "failed to discover initrd image"
test "${INITRDNAME#/}" = "$INITRDNAME" && INITRDNAME="$BOOTDIR$INITRDNAME"
+with_set_ex /sbin/debugfs "$IMAGE" -R "cat $KERNELNAME" > "$KERNELTMP"
+with_set_ex /sbin/debugfs "$IMAGE" -R "cat $INITRDNAME" > "$INITRDTMP"
+
# Refine our VMARCH guess from /bin/true using the kernel image to improve
# experience for multiarch kernels.
if command -v file >/dev/null 2>&1; then
@@ -342,9 +352,4 @@ set -- \
-device "$NIC_DEV" \
"$@"
-set -ex
-
-/sbin/debugfs "$IMAGE" -R "cat $KERNELNAME" > "$KERNELTMP"
-/sbin/debugfs "$IMAGE" -R "cat $INITRDNAME" > "$INITRDTMP"
-
-"$QEMU" "$@"
+with_set_ex "$QEMU" "$@"