guests/freebsd: Escape guest path in rsync folders
This commit is contained in:
parent
3b2ffae400
commit
72dcf610f7
|
@ -1,3 +1,5 @@
|
||||||
|
require "shellwords"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module GuestFreeBSD
|
module GuestFreeBSD
|
||||||
module Cap
|
module Cap
|
||||||
|
@ -15,9 +17,8 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.rsync_pre(machine, opts)
|
def self.rsync_pre(machine, opts)
|
||||||
machine.communicate.tap do |comm|
|
guest_path = Shellwords.escape(opts[:guestpath])
|
||||||
comm.sudo("mkdir -p '#{opts[:guestpath]}'")
|
machine.communicate.sudo("mkdir -p #{guest_path}")
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.rsync_post(machine, opts)
|
def self.rsync_post(machine, opts)
|
||||||
|
@ -25,8 +26,10 @@ module VagrantPlugins
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
guest_path = Shellwords.escape(opts[:guestpath])
|
||||||
|
|
||||||
machine.communicate.sudo(
|
machine.communicate.sudo(
|
||||||
"find '#{opts[:guestpath]}' '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " +
|
"find #{guest_path} '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " +
|
||||||
"xargs -0 -r chown #{opts[:owner]}:#{opts[:group]}")
|
"xargs -0 -r chown #{opts[:owner]}:#{opts[:group]}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue