Releases: CandoImage/winnfsd
Continued: Fix for handling in case of multiple mounts / paths && merged changes from Yasushi/winnfsd
Continued the attempt fixing winnfsd#13
There was still an issue with the siblings iteration on the top-level mounts.
Should work better now.
Further the changes from the https://github.com/Yasushi/winnfsd fork were merged.
Which should fix some path alias handling issues: Yasushi#4
Below you can find the vagrantfile we use to patch vagrant-winnfsd on the fly to:
- Use the current binary
- Use the new mounting syntax
- Write config into the user- instead the program-directory to avoid problems with windows UAC.
# The code in the condition is only needed when the machine is built / reloaded.
if ARGV[0] == "up" || ARGV[0] == "reload" then
# Windows check.
is_windows = (RbConfig::CONFIG['host_os'].match(/mswin|mingw|cygwin/i))
# If this is Windows make sure the NFS stuff can work.
if (is_windows)
# Because the program files directory isn't necessarily writable (UAC) and so
# on, we patch up the vagrant-winnfs plugin to use the vagrant user directory.
# Created a pull request with the change:
# https://github.com/winnfsd/vagrant-winnfsd/pull/85
puts "Patching plugin vagrant-winnfsd"
patching_file = Vagrant.user_data_path.join("gems/gems/vagrant-winnfsd-1.1.0/lib/vagrant-winnfsd/cap/nfs.rb")
puts " Patching config location"
if File.exist?(patching_file)
File.write(patching_file, File.open(patching_file,&:read).gsub("\"\#{Vagrant.source_root}/nfspaths\"","\"\#{Vagrant.user_data_path}/nfspaths\""))
puts " -> done"
end
# Download our own binary because the current 1.0.1 version has issues.
binary_file = Vagrant.user_data_path.join("gems/gems/vagrant-winnfsd-1.1.0/bin/winnfsd.exe")
puts " Patching binary"
require "digest"
checksum = Digest::MD5.file(binary_file).hexdigest
if !checksum.eql? "90db3d0e1695a069891936ece23287da"
if File.exist?(binary_file)
if File.writable?(binary_file)
# Use open-uri because it follows redirects.
require "open-uri"
open("https://github.com/CandoImage/winnfsd/releases/download/2.0.3-beta/winnfsd.exe") {|f|
File.open(binary_file,"wb") do |file|
file.puts f.read
end
}
puts " -> done"
else
puts " -> Failed, file not writable."
end
end
else
puts " -> Already done - skip binary download."
end
# Adjust mounting in the new version.
patching_file = Vagrant.user_data_path.join("gems/gems/vagrant-winnfsd-1.1.0/lib/vagrant-winnfsd/synced_folder.rb")
puts " Patching mount syntax"
if File.exist?(patching_file)
File.write(patching_file, File.open(patching_file,&:read).gsub(".gsub(':', '')","").gsub("= '/' +","="))
puts " -> done"
end
end
end
2.0.2-beta: Fix for handling in case of multiple mounts / paths
An attempt in fixing this issue winnfsd/issues/13
The server was crashing when you had two path mappings and you tried to mount both of them.
It looks like there was no handling in place to actually figure out which path mapping has to be used for the mounted path.
This ultimately led to unhandled errors.
The patched version is more defensive when using the currently selected path mapping and if it doesn't fit it searches a fitting path mapping for the mounted path.