$ vagrant plugin install vagrant-winnfsd
文件 1:homestead/scripts/homestead.rb
# Register All Of The Configured Shared Folders
if settings.include? 'folders'
settings["folders"].sort! { |a,b| a["map"].length <=> b["map"].length }
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"],
id: folder["map"],
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime']
end
end
# Change PHP CLI version based on configuration
if settings.has_key?('php') && settings['php']
config.vm.provision 'shell' do |s|
s.name = 'Changing PHP CLI Version'
s.inline = "sudo update-alternatives --set php /usr/bin/php#{settings['php']}; sudo update-alternatives --set php-config /usr/bin/php-config#{settings['php']}; sudo update-alternatives --set phpize /usr/bin/phpize#{settings['php']}"
end
end
# Creates folder for opt-in features lockfiles
config.vm.provision "shell", inline: "mkdir -p /home/vagrant/.homestead-features"
config.vm.provision "shell", inline: "chown -Rf vagrant:vagrant /home/vagrant/.homestead-features"
# Install opt-in features
if settings.has_key?('features')
settings['features'].each do |feature|
feature_name = feature.keys[0]
feature_variables = feature[feature_name]
feature_path = script_dir + "/features/" + feature_name + ".sh"
# Check for boolean parameters
# Compares against true/false to show that it really means "<feature>: <boolean>"
if feature_variables == false
config.vm.provision "shell", inline: "echo Ignoring feature: #{feature_name} because it is set to false \n"
next
elsif feature_variables == true
# If feature_arguments is true, set it to empty, so it could be passed to script without problem
feature_variables = {}
end
# Check if feature really exists
if !File.exist? File.expand_path(feature_path)
config.vm.provision "shell", inline: "echo Invalid feature: #{feature_name} \n"
next
end
config.vm.provision "shell" do |s|
s.name = "Installing " + feature_name
s.path = feature_path
s.env = feature_variables
end
end
end
将以上代码替换成下面的:
if settings.include? 'folders'
settings["folders"].sort! { |a,b| a["map"].length <=> b["map"].length }
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"],
id: folder["map"],
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime']
end
end
文件 2:Homestead.yaml
folders:
- map: ~/Code
to: /home/vagrant/Code
type: "nfs"
最后运行vagrant reload --provision重启即可
最新评论