vagrant/plugins/guests/linux/cap/rsync.rb

29 lines
833 B
Ruby
Raw Normal View History

module VagrantPlugins
module GuestLinux
module Cap
class RSync
def self.rsync_installed(machine)
machine.communicate.test("which rsync")
end
def self.rsync_pre(machine, opts)
username = machine.ssh_info[:username]
machine.communicate.tap do |comm|
comm.sudo("mkdir -p '#{opts[:guestpath]}'")
comm.sudo("find '#{opts[:guestpath]}' ! -user #{username} -print0 | " +
"xargs -0 -r chown -v #{username}:")
end
end
def self.rsync_post(machine, opts)
machine.communicate.tap do |comm|
2014-03-13 16:48:53 +00:00
comm.sudo("find '#{opts[:guestpath]}' ! -user #{opts[:owner]} -print0 | " +
"xargs -0 -r chown -v #{opts[:owner]}:#{opts[:group]}")
end
end
end
end
end
end