Add Vagrantfile for building on VirtualBox
[ctsim.git] / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 # All Vagrant configuration is done below. The "2" in Vagrant.configure
5 # configures the configuration version (we support older styles for
6 # backwards compatibility). Please don't change it unless you know what
7 # you're doing.
8 Vagrant.configure("2") do |config|
9   config.vm.box = "hashicorp/bionic64"
10
11   # Disable automatic box update checking. If you disable this, then
12   # boxes will only be checked for updates when the user runs
13   # `vagrant box outdated`. This is not recommended.
14   # config.vm.box_check_update = false
15
16   # Create a forwarded port mapping which allows access to a specific port
17   # within the machine from a port on the host machine. In the example below,
18   # accessing "localhost:8080" will access port 80 on the guest machine.
19   # NOTE: This will enable public access to the opened port
20   # config.vm.network "forwarded_port", guest: 80, host: 8080
21
22   # Create a forwarded port mapping which allows access to a specific port
23   # within the machine from a port on the host machine and only allow access
24   # via 127.0.0.1 to disable public access
25   # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
26
27   # Create a private network, which allows host-only access to the machine
28   # using a specific IP.
29   # config.vm.network "private_network", ip: "192.168.33.10"
30
31   # Create a public network, which generally matched to bridged network.
32   # Bridged networks make the machine appear as another physical device on
33   # your network.
34   # config.vm.network "public_network"
35
36   config.vm.provider "virtualbox" do |vb|
37   #   # Display the VirtualBox GUI when booting the machine
38   #   vb.gui = true
39     vb.memory = "2048"
40     vb.cpus = "2"
41   end
42
43   config.vm.provision "shell", inline: <<-SHELL
44     FILE=/etc/apt/preferences.d/99grub
45     echo "Package: /(grub-common|grub2-common|grub-pc)/
46 Pin: release *
47 Pin-Priority: -1" > $FILE
48     apt-get update
49     apt-get dist-upgrade -y
50     apt-get install -yy debhelper libfftw3-dev libreadline-dev libgl1-mesa-dev libglu1-mesa-dev libwxgtk3.0-dev ctn-dev libpng-dev git
51     apt-get autoremove -y
52     rm $FILE
53     git clone git://git.kpe.io/ctsim.git
54     DIR=/home/vagrant/ctsim
55     cd $DIR
56     ./bootstrap.sh
57     chown -R vagrant:vagrant $DIR
58   SHELL
59
60 end