synced_folders/rsync: enable override of default chmod flag

fixed new file creation to follow guest's umask on Windows by default
This commit is contained in:
Steffen Müller 2014-04-05 11:01:09 +02:00
parent 6a7c25f198
commit 32f25b6a0d
1 changed files with 7 additions and 2 deletions

View File

@ -72,9 +72,14 @@ module VagrantPlugins
args = Array(opts[:args]) if opts[:args]
args ||= ["--verbose", "--archive", "--delete", "-z"]
# On Windows, we have to set the chmod flag to avoid permission issues
if Vagrant::Util::Platform.windows?
# On Windows, we have to set a default chmod flag to avoid permission issues
if Vagrant::Util::Platform.windows? && !args.any? { |arg| arg.start_with?("--chmod=") }
#Ensures that all non-masked bits get enabled
args << "--chmod=ugo=rwX"
#Remove the -p option if --archive is enabled (--archive equals -rlptgoD)
#otherwise new files will not have the destination-default permissions
args << "--no-perms" if (args.include? "--archive") || (args.include? "-a")
end
# Build up the actual command to execute