From b6b7f54e0caaeca22a1b445ab7b2fdfa460a80cd Mon Sep 17 00:00:00 2001 From: Gereon Frey Date: Wed, 25 Apr 2018 08:26:46 +0200 Subject: [PATCH] Add support for OpenBSD With OpenBSD there is one major problem: no support for proper file sharing (neither virtualbox sharing nor NFS). The only option left is using the rsync mechanism, which has two glitches: * It requires an explicit `vagrant rsync` to update code in a running guest, as the sync mechanism is otherwise only triggered on `vagrant up` and `vagrant reload`. * The rsync mechanism is one way from host to guest. For getting files out of the guest some other mechanism must be used (there is a plugin `rsync-back` that worked for me). --- Vagrantfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 64280ff..bea0d5c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -40,6 +40,18 @@ def provision_bsd SCRIPT end +def provision_obsd + <<-SCRIPT + set -x + # set -e + . /root/.profile + /usr/sbin/pkg_add wget bash + + #{install_go_source} + #{update_profile} + SCRIPT +end + def provision_solaris <<-SCRIPT set -x @@ -126,6 +138,21 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| bsd.ssh.shell = "sh" # for provisioning end + # Using RSync for synced/shared folders as OpenBSD doesn't support anything + # else, but `vagrant rsync` is a one-way mechanisms only. There is a plugin + # called rsync-back that might be used to get files back from the guest. + # An explicit `vagrant rsync obsd` is required, to update the code in a + # running guest (rsync will only be executed automatically on `vagrant up` + # and `vagrant reload`). + config.vm.define "obsd" do |obsd| + obsd.vm.box = "twingly/openbsd-6.2-amd64" + obsd.vm.synced_folder ".", "/home/vagrant/src", + :type => "rsync", :rsync__exclude => [".git"] + obsd.vm.synced_folder ".", "/vagrant", disabled: true + obsd.vm.provision :shell, :inline => provision_obsd + obsd.ssh.shell = "sh" # for provisioning + end + config.vm.define "solaris" do |solaris| solaris.vm.box = "openindiana/hipster" solaris.vm.synced_folder src_path, "/export/home/vagrant/src"