aboutsummaryrefslogtreecommitdiff
path: root/vm/ubuntu.sh
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2026-02-17 02:41:07 +0100
committerbozo.kopic <bozo@kopic.xyz>2026-02-17 02:41:07 +0100
commitec47c850389e61f69dc413c551e5f2438ce630df (patch)
treebec1695b1aba2a2668860cc5c010fff67b380cc5 /vm/ubuntu.sh
parent56b45d7f00a1c70319c836a7cc917b00e5e6d2d0 (diff)
.
Diffstat (limited to 'vm/ubuntu.sh')
-rw-r--r--vm/ubuntu.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/vm/ubuntu.sh b/vm/ubuntu.sh
new file mode 100644
index 0000000..d947a4a
--- /dev/null
+++ b/vm/ubuntu.sh
@@ -0,0 +1,30 @@
+: ${VM_CACHE:?} ${VM_DATA:?}
+
+ubuntu_url=http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/mini.iso
+
+iso_path=$VM_CACHE/ubuntu.iso
+
+image_path=$VM_DATA/ubuntu.qcow2
+
+
+if [ ! -f $iso_path ]; then
+ curl -L -o $iso_path $ubuntu_url
+fi
+
+if [ ! -f $image_path ]; then
+ qemu-img create -f qcow2 $image_path 20G
+fi
+
+exec qemu-system-x86_64 \
+ -enable-kvm \
+ -cpu host \
+ -hda $image_path \
+ -cdrom $iso_path \
+ -m 4G \
+ -device e1000,netdev=net0 \
+ -netdev user,id=net0 \
+ -usb \
+ -device usb-tablet \
+ -vga std \
+ -virtfs local,path=$VM_TMP,mount_tag=shared,security_model=none \
+ "$@"