2021-08-30 11:31:56 -04:00
|
|
|
#!/usr/bin/make -sf
|
|
|
|
|
|
|
|
# script for managing the vm for the csc mirror dev environment
|
|
|
|
|
|
|
|
# dependencies =-=-=-=-=-=-=-=
|
2021-09-02 15:47:07 -04:00
|
|
|
# qemu, genisoimage, ovmf (find the location of OVMF_CODE.fd on your system)
|
2021-08-30 11:31:56 -04:00
|
|
|
|
|
|
|
# user config variables =-=-=
|
|
|
|
disk_size=10G
|
|
|
|
vm_mem=2G
|
|
|
|
ovmf_location=/usr/share/edk2-ovmf/x64/OVMF_CODE.fd
|
|
|
|
install_iso=./ubuntu-20.04.2-live-server-amd64.iso
|
2021-09-02 15:47:07 -04:00
|
|
|
ssh_port=7777
|
2021-08-30 11:31:56 -04:00
|
|
|
|
2021-09-02 15:47:07 -04:00
|
|
|
.PHONY: help create clean run-install run
|
2021-08-30 11:31:56 -04:00
|
|
|
|
|
|
|
help:
|
2021-09-02 15:47:07 -04:00
|
|
|
echo help|create|clean|run-install|run
|
2021-08-30 11:31:56 -04:00
|
|
|
|
|
|
|
.ONESHELL:
|
|
|
|
create:
|
|
|
|
for i in {1..6}; do
|
|
|
|
qemu-img create -f qcow2 drive$$i ${disk_size}; done
|
|
|
|
genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
|
|
|
|
|
2021-09-02 15:47:07 -04:00
|
|
|
clean:
|
2021-08-30 11:31:56 -04:00
|
|
|
rm drive* seed.iso
|
|
|
|
|
|
|
|
run-install:
|
|
|
|
qemu-system-x86_64 -cdrom ${install_iso} -enable-kvm -boot order=d \
|
|
|
|
-drive file=drive1,if=virtio,id=a,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive2,if=virtio,id=b,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive3,if=virtio,id=c,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive4,if=virtio,id=d,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive5,if=virtio,id=e,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive6,if=virtio,id=f,media=disk,format=qcow2 \
|
|
|
|
-drive file=seed.iso,if=virtio,format=raw \
|
|
|
|
-bios ${ovmf_location} \
|
|
|
|
-m ${vm_mem}
|
|
|
|
|
|
|
|
run:
|
|
|
|
qemu-system-x86_64 -enable-kvm -boot order=d \
|
|
|
|
-drive file=drive1,if=virtio,id=a,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive2,if=virtio,id=b,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive3,if=virtio,id=c,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive4,if=virtio,id=d,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive5,if=virtio,id=e,media=disk,format=qcow2 \
|
|
|
|
-drive file=drive6,if=virtio,id=f,media=disk,format=qcow2 \
|
|
|
|
-bios ${ovmf_location} \
|
|
|
|
-m ${vm_mem} \
|
2021-09-02 15:47:07 -04:00
|
|
|
-net user,hostfwd=tcp::${ssh_port}-:22 \
|
2021-08-30 11:31:56 -04:00
|
|
|
-net nic
|
|
|
|
|