summaryrefslogtreecommitdiff
path: root/build-tools/macos-build/Vagrantfile
diff options
context:
space:
mode:
Diffstat (limited to 'build-tools/macos-build/Vagrantfile')
-rw-r--r--build-tools/macos-build/Vagrantfile39
1 files changed, 39 insertions, 0 deletions
diff --git a/build-tools/macos-build/Vagrantfile b/build-tools/macos-build/Vagrantfile
new file mode 100644
index 0000000..f1b86a4
--- /dev/null
+++ b/build-tools/macos-build/Vagrantfile
@@ -0,0 +1,39 @@
+PROVISION = <<-SCRIPT
+sudo apt-get update -y
+sudo apt-get install apt-transport-https \
+ ca-certificates \
+ curl \
+ gnupg2 \
+ git \
+ software-properties-common \
+ rsync -y
+curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
+sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
+sudo apt-get update -y
+sudo apt-get install -y docker-ce
+[ -d /home/vagrant/.ssh ] && echo '%{public_key}' >> /home/vagrant/.ssh/authorized_keys; true
+[ -d /home/vagrant/.ssh ] && chmod 600 /home/vagrant/.ssh/authorized_keys; true
+sudo usermod -aG docker vagrant
+git clone -b #{ENV['BRANCH']} --single-branch https://github.com/vyos/vyos-build /opt/vyos-build
+docker run --rm -t --privileged -v /opt/vyos-build:/vyos -w /vyos vyos/vyos-build:#{ENV['BRANCH']} \
+ /bin/bash -c './configure #{ENV['CONFIGUREOPT']} && make #{ENV['MAKEOPT']}'
+SCRIPT
+
+def define_vm(config, hostname, ip)
+ public_key_path = File.join(Dir.home, ".ssh", "id_rsa.pub")
+ public_key = IO.read(public_key_path)
+
+ config.vm.define hostname do |vm|
+ vm.vm.box = "debian/#{ENV['OS']}"
+ vm.vm.hostname = hostname
+ vm.vm.network 'private_network', ip: ip
+
+ vm.vm.provision :shell, inline: (PROVISION % { public_key: public_key })
+
+ end
+end
+
+Vagrant.configure("2") do |config|
+ define_vm(config, "vyos", "10.1.1.254")
+ config.vm.synced_folder ".", "/vagrant", disabled: true
+end