Class: VagrantPlugins::GuestMSYS2::Cap::RSync

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-guest-msys2/cap/rsync.rb

Class Method Summary collapse

Class Method Details

.rsync_command(machine) ⇒ Object



14
15
16
# File 'lib/vagrant-guest-msys2/cap/rsync.rb', line 14

def self.rsync_command(machine)
  'rsync'
end

.rsync_install(machine) ⇒ Object



9
10
11
12
# File 'lib/vagrant-guest-msys2/cap/rsync.rb', line 9

def self.rsync_install(machine)
  machine.communicate.execute(
    'pacman -S --noconfirm rsync')
end

.rsync_installed(machine) ⇒ Object



5
6
7
# File 'lib/vagrant-guest-msys2/cap/rsync.rb', line 5

def self.rsync_installed(machine)
  machine.communicate.test('which rsync')
end

.rsync_post(machine, opts) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vagrant-guest-msys2/cap/rsync.rb', line 24

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

.rsync_pre(machine, opts) ⇒ Object



18
19
20
21
22
# File 'lib/vagrant-guest-msys2/cap/rsync.rb', line 18

def self.rsync_pre(machine, opts)
  machine.communicate.tap do |comm|
    comm.execute("mkdir -p '#{opts[:guestpath]}'")
  end
end