summaryrefslogtreecommitdiff
path: root/tests/autopkgtest-qemu-efi.sh
blob: bc761d582bb642a57abbcd6b08bd7d71bf709e6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

set -eux

IMAGE=test.img
RELEASE="${1:-}"

cleanup() {
	rm -f "$IMAGE"
}
trap cleanup EXIT
cleanup_abort() {
	cleanup
	echo aborted >&2
	exit 2
}
trap cleanup_abort HUP INT TERM QUIT

INSTALL_LOCATION=$(command -v debefivm-create)
if test "${INSTALL_LOCATION#/usr/}" = "$INSTALL_LOCATION"; then
	USERADDHOOK="${INSTALL_LOCATION%/*}/../useraddhook"
else
	USERADDHOOK=/usr/share/mmdebstrap/hooks/useradd
fi

set -- --
if test -z "$RELEASE"; then
	# We no longer need usrmerge in trixie and later and it does not work
	# with copy-host-apt-sources-and-preferences in the default order.
	set -- \
		--skip=usrmerge \
		"$@" \
		--hook-dir=/usr/share/mmdebstrap/hooks/copy-host-apt-sources-and-preferences \
		--hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount \
		""
fi

debefivm-create \
	-o "$IMAGE" \
	-r "$RELEASE" \
	"$@" \
	--include=linux-image-generic,libpam-systemd,passwd,python3 \
	--hook-dir="$USERADDHOOK" \
	--customize-hook=/usr/share/autopkgtest/setup-commands/setup-testbed

autopkgtest hello -- qemu --boot=efi --show-boot "$IMAGE"