summaryrefslogtreecommitdiff
path: root/tests/efi-create-and-run.sh
diff options
context:
space:
mode:
authorHelmut Grohne <helmutg@debian.org>2025-04-11 13:17:17 +0000
committerHelmut Grohne <helmutg@debian.org>2025-04-11 13:17:17 +0000
commitc4faa82f9c451d06ee8598e633c3a8e77c449bfe (patch)
tree3bb2cd8e17d4493f61362412aa262bdfcb0ada76 /tests/efi-create-and-run.sh
parent0ef75afe1fe982df1bacfcddd9c6dc354ad07ea5 (diff)
parent437a5587f1ac95fd340ba45a5c9933d4c7a24f4b (diff)
downloaddebvm-c4faa82f9c451d06ee8598e633c3a8e77c449bfe.tar.gz
Merge branch 'debefivm' into 'main'
add a new family of wrappers for EFI based images See merge request helmutg/debvm!49
Diffstat (limited to 'tests/efi-create-and-run.sh')
-rwxr-xr-xtests/efi-create-and-run.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/efi-create-and-run.sh b/tests/efi-create-and-run.sh
new file mode 100755
index 0000000..2b70662
--- /dev/null
+++ b/tests/efi-create-and-run.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+if test "$#" -ne 2; then
+ echo "$(basename "$0") takes two positional arguments: architecture and release" 1>&2
+ exit 1
+fi
+ARCHITECTURE=$1
+RELEASE=$2
+SSH_KEYPATH=ssh_id
+IMAGE=test.img
+
+set -eux
+
+. "$(dirname "$0")/test_common.sh"
+
+cleanup() {
+ rm -f "$SSH_KEYPATH" "$SSH_KEYPATH.pub" "$IMAGE"
+}
+
+trap cleanup EXIT INT TERM QUIT
+
+ssh-keygen -f "$SSH_KEYPATH" -N ''
+set -- --
+if test -z "$RELEASE"; then
+ # The ordering of maybe-merged-usr and
+ # copy-host-apt-sources-and-preferences is unfortunately the wrong way
+ # round. Therefore, we make debvm-create skip it and pass it ourselves.
+ # The final empty string is the mirror specification.
+ set -- \
+ --skip=usrmerge \
+ "$@" \
+ --hook-dir=/usr/share/mmdebstrap/hooks/copy-host-apt-sources-and-preferences \
+ --hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount \
+ --hook-dir=/usr/share/mmdebstrap/hooks/maybe-merged-usr \
+ ""
+fi
+debefivm-create -k "$SSH_KEYPATH.pub" -o "$IMAGE" -r "$RELEASE" -a "$ARCHITECTURE" "$@"
+
+SSH_PORT=2222
+timeout 600s debefivm-run -s "$SSH_PORT" -i "$IMAGE" &
+set -- localhost
+debvm-waitssh -t 540 "$SSH_PORT"
+run_ssh "$@" poweroff
+wait
+
+"$(dirname "$0")/shell_interaction.expect" -- debefivm-run -i "$IMAGE"