Sha256: 9929876a7b75086e6fd23d35351e72110aeae2d7928c4d1a6e0b9d84be1d937b

Contents?: true

Size: 935 Bytes

Versions: 2

Compression:

Stored size: 935 Bytes

Contents

require "shellwords"

module VagrantPlugins
  module GuestLinux
    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} " +
            "'!' -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

2 entries across 2 versions & 1 rubygems

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