# Define UBUNTU_SSO_NAME to your UNIX username on login.ubuntu.com.
UBUNTU_SSO_NAME?=$(error set UBUNTU_SSO_NAME to your username on login.ubuntu.com)
# Boot our working image and redirect SSH and HTTP ports to localhost.
.PHONY: boot
boot: ubuntu-core-16-amd64.img
kvm -smp 2 -m 1500 -netdev user,id=mynet0,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 -device virtio-net-pci,netdev=mynet0 -vga qxl -drive file=ubuntu-core-16-amd64.img,format=raw
# Login into our booted image. Run after running boot from another terminal.
.PHONY: login
login:
ssh -p 8022 $(UBUNTU_SSO_NAME)@localhost
# Uncompress the vanilla image into our working image.
ubuntu-core-16-amd64.img: ubuntu-core-16-amd64.img.xz
unxz --keep ubuntu-core-16-amd64.img.xz
# Download the compressed, vanilla image.
.PRECIOUS: ubuntu-core-16-amd64.img.xz
ubuntu-core-16-amd64.img.xz:
wget http://cdimage.ubuntu.com/ubuntu-core/16/stable/current/ubuntu-core-16-amd64.img.xz