Sha256: bfbc4d88b8c07c7e365a3086782c41a86239010063e4ea586e35fcdd39a3ecef

Contents?: true

Size: 884 Bytes

Versions: 2

Compression:

Stored size: 884 Bytes

Contents

require "shellwords"

module VagrantPlugins
  module GuestDarwin
    module Cap
      class RSync
        def self.rsync_installed(machine)
          machine.communicate.test("which rsync")
        end

        def self.rsync_command(machine)
          "sudo rsync"
        end

        def self.rsync_pre(machine, opts)
          guest_path = Shellwords.escape(opts[:guestpath])
          machine.communicate.sudo("mkdir -p #{guest_path}")
        end

        def self.rsync_post(machine, opts)
          if opts.key?(:chown) && !opts[:chown]
            return
          end

          guest_path = Shellwords.escape(opts[:guestpath])

          machine.communicate.sudo(
            "find #{guest_path} '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " +
            "xargs -0 chown #{opts[:owner]}:#{opts[:group]}")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-unbundled-1.8.5.2 plugins/guests/darwin/cap/rsync.rb
vagrant-unbundled-1.8.5.1 plugins/guests/darwin/cap/rsync.rb