Add hypervisor and move cleanup trap to setup body

This commit is contained in:
Alex D. 2024-11-16 22:27:59 +00:00
parent cd8d9c8dd4
commit 684c285f7e
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 38 additions and 3 deletions

View File

@ -70,6 +70,9 @@ setup() {
BOOT_LABEL="nnd-boot"
CRYPT_LABEL="nnd-root-encrypted"
# Always clean up
trap cleanup_err INT TERM EXIT HUP
# Set up file as loopback
fallocate -v -l "$size" "$image"
if ! [ -r "$image" ]; then
@ -249,6 +252,3 @@ custom() {
echo "Upon exit, the image will be packed."
wrapped sh || true # Handle graceful exit
}
# Always clean up
trap cleanup_err INT TERM EXIT HUP

35
make-root/hypervisor.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# Exit on any errors
set -e
DIR="$(dirname "$0")"
. "$DIR"/func.sh
depcheck
kextparam="console=ttyS0 console=tty0" kflav="lts" size=4G setup
addpkg \
openssh-server \
libvirt \
libvirt-qemu \
libvirt-client \
qemu \
qemu-audio-spice \
qemu-chardev-spice \
qemu-hw-display-qxl \
qemu-hw-display-virtio-vga \
qemu-hw-usb-host \
qemu-hw-usb-redirect \
qemu-img \
qemu-system-x86_64 \
qemu-ui-spice-core \
swtpm
addtty ttyS0
addsvc bundle.core bundle.net bundle.libvirt bundle.tty sshd.1
addsshkey "$DIR"/id_ed25519.pub
pack