Sha256: 3b697b86d18b03d4d2aca5cef9c3a11f59ac389cfa41e0a1dd47006a0ba13d52

Contents?: true

Size: 999 Bytes

Versions: 3

Compression:

Stored size: 999 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-guest-msys2-0.0.6 lib/vagrant-guest-msys2/cap/rsync.rb
vagrant-guest-msys2-0.0.5 lib/vagrant-guest-msys2/cap/rsync.rb
vagrant-guest-msys2-0.0.4 lib/vagrant-guest-msys2/cap/rsync.rb