module VagrantPlugins module GuestMSYS2 module Cap class RSync def self.rsync_installed(machine) machine.communicate.test('which rsync') end def self.rsync_install(machine) machine.communicate.execute( 'pacman -S --noconfirm rsync') end def self.rsync_command(machine) 'rsync' end def self.rsync_pre(machine, opts) machine.communicate.tap do |comm| comm.execute("mkdir -p '#{opts[:guestpath]}'") end end def self.rsync_post(machine, opts) if opts.key?(:chown) && !opts[:chown] return end machine.communicate.execute( "find '#{opts[:guestpath]}' " + "'!' -type l -a " + "'(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " + "xargs -0 -r chown #{opts[:owner]}:#{opts[:group]}") end end end end end