aboutsummaryrefslogtreecommitdiff
path: root/vm/ubuntu.sh
blob: 56b9e6733075a4a979f6caf873d57f3a920cea0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
: ${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 \
    -display spice-app \
    "$@"