#!/bin/sh

# if [ $# -ne 1 ]; then
#     echo "$0: owner"
#     exit 1
# fi

qemu=/usr/bin/qemu-system-x86_64

accel=kvm
#accel=tcg

memory=1024
cores=2
uuid=$(uuidgen)
mac=$(./mac-gen.py)
owner=nico

export bridge=br100

set -x
$qemu -name "uncloud-${uuid}" \
      -machine pc,accel=${accel} \
      -m ${memory} \
      -smp ${cores} \
      -uuid ${uuid} \
      -drive file=alpine-virt-3.11.2-x86_64.iso,media=cdrom \
      -netdev tap,id=netmain,script=./ifup.sh,downscript=./ifdown.sh \
      -device virtio-net-pci,netdev=netmain,id=net0,mac=${mac}
