From 99dac9c283af05c66539b7b32342e45ab7e58110 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 7 May 2019 14:01:31 -0500 Subject: [PATCH] Vagrant: Support libvirt, add sshfs dependency --- Makefile | 6 +++--- Vagrantfile | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7708410f..fb41d981 100644 --- a/Makefile +++ b/Makefile @@ -93,11 +93,11 @@ install: configure deploy: configure vagrant ssh -c 'make -C $(BUILD_DIR)/ deploy' mkdir -p vagrant_share/$(DEPLOY_DIR) - vagrant ssh -c 'cp -a $(BUILD_DIR)/deploy/* /vagrant/$(DEPLOY_DIR)' + vagrant ssh -c 'cp $(BUILD_DIR)/deploy/* /vagrant/$(DEPLOY_DIR)' echo "Proton deployed to vagrant_share/$(DEPLOY_DIR)" module: configure vagrant ssh -c 'make -C $(BUILD_DIR)/ module=$(module) module' mkdir -p vagrant_share/$(module)/lib{,64}/wine/ - vagrant ssh -c 'cp -a $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib/wine/' - vagrant ssh -c 'cp -a $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib64/wine/' + vagrant ssh -c 'cp $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib/wine/' + vagrant ssh -c 'cp $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib64/wine/' diff --git a/Vagrantfile b/Vagrantfile index e735ca8a..4ff4e87c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,6 +4,11 @@ # Vagrant file for setting up a build environment for Proton. Vagrant.configure(2) do |config| + #libvirt doesn't have a decent synced folder, so we have to use vagrant-sshfs. + #This is not needed for virtualbox, but I couldn't find a way to use a + #different synced folder type per provider, so we always use it. + config.vagrant.plugins = "vagrant-sshfs" + config.vm.box = "generic/debian9" config.vm.provider "virtualbox" do |v| @@ -12,9 +17,16 @@ Vagrant.configure(2) do |config| v.memory = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 2 end - #set up shared and rsynced folders - config.vm.synced_folder "./vagrant_share/", "/vagrant/", id: "share", create: true - config.vm.synced_folder ".", "/home/vagrant/proton", id: "proton", type: "rsync", rsync__exclude: ["/output/", "vagrant_share"] + config.vm.provider "libvirt" do |v| + v.cpus = `nproc`.to_i + # meminfo shows KB and we need to convert to MB + v.memory = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 2 + v.random_hostname = true + v.default_prefix = ENV['USER'].to_s.dup.concat('_').concat(File.basename(Dir.pwd)) + end + + config.vm.synced_folder "./vagrant_share/", "/vagrant/", create: true, type: "sshfs", sshfs_opts_append: "-o cache=no" + config.vm.synced_folder ".", "/home/vagrant/proton", id: "proton", type: "rsync", rsync__exclude: ["vagrant_share"] #this is where the VM is initialized on first setup config.vm.provision "shell", privileged: "true", inline: <<-SHELL