#!/usr/bin/env bash # # Copyright (C) 2020 David Runge # # SPDX-License-Identifier: GPL-3.0-or-later # # A simple script to run an archiso image using qemu. The image can be booted # using BIOS or UEFI. # # Requirements: # - qemu # - edk2-ovmf (when UEFI booting) set -eu print_help() { local usagetext IFS='' read -r -d '' usagetext < 0 )); then while getopts 'abdhi:suv' flag; do case "$flag" in a) accessibility='on' ;; b) boot_type='bios' ;; d) mediatype='hd' ;; h) print_help exit 0 ;; i) image="$OPTARG" ;; u) boot_type='uefi' ;; s) secure_boot='on' ;; v) display='none' qemu_options+=(-vnc 'vnc=0.0.0.0:0,vnc=[::]:0') ;; *) printf '%s\n' "Error: Wrong option. Try 'run_archiso -h'." exit 1 ;; esac done else print_help exit 1 fi check_image run_image