You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
Bash
39 lines
1.0 KiB
Bash
#!/bin/sh
|
|
|
|
set -exu
|
|
|
|
disk_size=4G
|
|
|
|
dl_alpine() {
|
|
tmpdir="$(mktemp --directory)"
|
|
trap "rm $tmpdir" EXIT
|
|
pushd "$tmpdir"
|
|
|
|
# Setup GPG
|
|
wget 'https://alpinelinux.org/keys/ncopa.asc'
|
|
gpg --import ncopa.asc
|
|
|
|
wget 'https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/x86_64/alpine-virt-3.15.4-x86_64.iso' 'https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/x86_64/alpine-virt-3.15.4-x86_64.iso.asc'
|
|
gpg --verify alpine-virt-3.15.4-x86_64.iso.asc alpine-virt-3.15.4-x86_64.iso
|
|
|
|
# Cleanup
|
|
popd
|
|
mv "$tmpdir/alpine-virt-3.15.4-x86_64.iso" .
|
|
rm "$tmpdir/alpine-virt-3.15.4-x86_64.iso.asc" "$tmpdir/ncopa.asc"
|
|
rmdir "$tmpdir"
|
|
trap - EXIT
|
|
}
|
|
|
|
test -f alpine-virt-3.15.4-x86_64.iso || dl_alpine
|
|
|
|
# Clean old disk
|
|
test -f dummydisk.img && rm dummydisk.img
|
|
|
|
qemu-img create -f raw dummydisk.img "$disk_size"
|
|
|
|
# Launch installation
|
|
# Basic VM is sufficient
|
|
qemu-system-x86_64 -enable-kvm -m 2G -cdrom alpine-virt-3.15.4-x86_64.iso -drive media=disk,format=raw,file=dummydisk.img
|
|
|
|
# Now the user has to run installation from the VM. See ./alpine_install for details.
|