# This Vagrantfile is designed to be used with artifacts that have been built by goreleaser.
# (eg, snapshot builds on GitHub)


Vagrant.configure("2") do |config|
  config.vm.provision "shell", inline: "mkdir /etc/OliveTin && chmod o+w /etc/OliveTin/ && mkdir -p /opt/OliveTin-configs/ && chmod 0777 /opt/OliveTin-configs", privileged: true
  config.vm.provision "file", source: "configs/.", destination: "/opt/OliveTin-configs/"

  config.vm.provider :libvirt do |libvirt|
    libvirt.management_network_device = 'virbr0'
  end

  config.vm.define :stream9 do |i|
    i.vm.box = "centos/stream9"
    i.vm.provision "file", source: "/opt/OliveTin-snapshot/OliveTin_linux_amd64.rpm", destination: "$HOME/"
    i.vm.provision "shell", inline: "rpm -U OliveTin* && systemctl enable --now OliveTin && systemctl disable --now firewalld"
  end

  config.vm.define :fedora38 do |i|
    i.vm.box = "generic/fedora38"
    i.vm.provision "file", source: "/opt/OliveTin-snapshot/OliveTin_linux_amd64.rpm", destination: "$HOME/"
    i.vm.provision "shell", inline: "rpm -U OliveTin* && systemctl enable --now OliveTin && systemctl disable --now firewalld"
  end

  config.vm.define :debian12 do |i|
    i.vm.box = "debian/bookworm64"
    i.vm.provision "file", source: "/opt/OliveTin-snapshot/OliveTin_linux_amd64.deb", destination: "$HOME/"
    i.vm.provision "shell", inline: "dpkg --force-confold -i OliveTin* && systemctl enable --now OliveTin"
  end

  config.vm.define :ubuntu2310 do |i|
    i.vm.box = "ubuntu/mantic64"
    i.vm.provision "file", source: "/opt/OliveTin-snapshot/OliveTin_linux_amd64.deb", destination: "$HOME/"
    i.vm.provision "shell", inline: "dpkg --force-confold -i OliveTin* && systemctl enable --now OliveTin && systemctl disable --now firewalld"
  end
end
