summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/debvm-create24
-rwxr-xr-xtests/create-and-run.sh7
2 files changed, 17 insertions, 14 deletions
diff --git a/bin/debvm-create b/bin/debvm-create
index 521ad36..1c7c29d 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -11,7 +11,7 @@ debvm-create - Create a VM image for various Debian releases and architectures
=head1 SYNOPSIS
-B<debvm-create> [B<-a> I<architecture>] [B<-h> I<hostname>] [B<-k> F<sshkey>] [B<-o> F<output>] [B<-r> I<release>] [B<-s> <task>] [B<-z> I<size>] [B<--> I<mmdebstrap options>]
+B<debvm-create> [B<-h> I<hostname>] [B<-k> F<sshkey>] [B<-o> F<output>] [B<-r> I<release>] [B<-s> <task>] [B<-z> I<size>] [B<--> I<mmdebstrap options>]
=head1 DESCRIPTION
@@ -26,12 +26,6 @@ No user account is created and root can login without specifying a password.
=over 8
-=item B<-a> I<architecture>, B<--architecture>=I<architecture>
-
-Specify a Debian architecture name.
-By default, the native architecture is being used.
-A suitable kernel image is automatically selected and installed into the image.
-
=item B<-h> I<hostname>, B<--hostname>=I<hostname>
Set the hostname of the virtual machine.
@@ -131,11 +125,16 @@ All options beyond a double dash are passed to B<mmdebstrap> after the suite and
This can be used to provide additional hooks for image customization.
You can also request additional packages to be installed into the image using B<mmdebstrap>'s B<--include> option.
Any positional arguments passed here will be treated as mirror specifications by B<mmdebstrap>.
+In particular, you can also change the architecture of the resulting image using the B<--architecture> option.
=back
=head1 EXAMPLES
+When creating an image with multiple architectures, the kernel selection will prefer the sibling 64bit architecture.
+
+ debvm-create ... -- --architecture=armhf,arm64
+
In order to create images for Debian ports architectures, you can pass two options to mmdebstrap.
debvm-create ... -- http://deb.debian.org/debian-ports --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg
@@ -172,7 +171,7 @@ POD2MAN
set -u
-ARCHITECTURE=$(dpkg --print-architecture)
+ARCHITECTURE=
IMAGE=rootfs.ext4
INITSYSTEM=systemd
SIZE=1G
@@ -193,7 +192,7 @@ die() {
exit 1
}
usage() {
- die "usage: $0 [-a architecture] [-h hostname] [-k sshkey] [-o output] [-r release] [-s task] [-z size] [-- mmdebstrap options]"
+ die "usage: $0 [-h hostname] [-k sshkey] [-o output] [-r release] [-s task] [-z size] [-- mmdebstrap options]"
}
usage_error() {
echo "error: $*" 1>&2
@@ -201,6 +200,8 @@ usage_error() {
}
opt_architecture() {
+ # This option only exists for backwards-compatibility.
+ # You can pass it as mmdebstrap option instead.
ARCHITECTURE=$1
}
opt_hostname() {
@@ -303,10 +304,13 @@ set -- \
--verbose \
--variant=apt \
"--format=$MMFORMAT" \
- "--architecture=$ARCHITECTURE" \
'--customize-hook=echo "LABEL=debvm / ext4 defaults 0 0" >"$1/etc/fstab"' \
"$@"
+if test -n "$ARCHITECTURE"; then
+ set -- "--architecture=$ARCHITECTURE" "$@"
+fi
+
case "$INITSYSTEM" in
busybox)
set -- \
diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh
index c8efa3e..dfd45bf 100755
--- a/tests/create-and-run.sh
+++ b/tests/create-and-run.sh
@@ -20,14 +20,13 @@ cleanup() {
trap cleanup EXIT INT TERM QUIT
ssh-keygen -f "$SSH_KEYPATH" -N ''
-set --
case "$ARCHITECTURE" in
# Booting an armel kernel on qemu is next to impossible.
- armel) set -- -- --architecture armhf ;;
+ armel) ARCHITECTURE=armel,armhf ;;
# Broken kernel #1029270.
- i386) set -- -- --architecture amd64 ;;
+ i386) ARCHITECTURE=i386,amd64 ;;
esac
-debvm-create -k "$SSH_KEYPATH.pub" -o "$IMAGE" -a "$ARCHITECTURE" -r "$RELEASE" "$@"
+debvm-create -k "$SSH_KEYPATH.pub" -o "$IMAGE" -r "$RELEASE" -- --architectures="$ARCHITECTURE"
SSH_PORT=2222
timeout 300s debvm-run -s "$SSH_PORT" -i "$IMAGE" &