Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Don't spawn a subshell when checking if /vagrant is mounted (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrarimarco authored Apr 3, 2020
1 parent ed86cc1 commit f6f376b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -434,20 +434,24 @@ Vagrant.configure("2") do |config|
$mountNfsShare = ''
if(vagrant_provider == 'virtualbox')
$mountNfsShare = <<-'SCRIPT'
if ! "$(mount | grep /vagrant)" ; then
set -e
if ! mount | grep -qs /vagrant ; then
# From now on, we want the script to fail if we have problems mounting the shares
mount -t vboxsf vagrant /vagrant/
fi
SCRIPT
elsif(vagrant_provider == 'libvirt')
$mountNfsShare = <<-'SCRIPT'
if ! "$(mount | grep /vagrant)" ; then
set -e
if ! mount | grep -qs /vagrant ; then
# From now on, we want the script to fail if we have problems mounting the shares
mount -t nfs -o 'vers=3' $libvirt_management_host_address:$vagrant_root /vagrant
fi
SCRIPT
$mountNfsShare.gsub!("$libvirt_management_host_address", libvirt_management_host_address)
$mountNfsShare.gsub!("$vagrant_root", vagrant_root)
end
$mountNfsShare.gsub!("$libvirt_management_host_address", libvirt_management_host_address)
$mountNfsShare.gsub!("$vagrant_root", vagrant_root)
host.vm.provision "mount-shared", type:"shell", run: "never", inline: $mountNfsShare
host.vm.provision "mount-shared", type: "shell", run: "never", inline: $mountNfsShare
end
end
end
Expand Down

0 comments on commit f6f376b

Please sign in to comment.