8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/vagrant-solaris10/cap/mount_vmware_shared_folder.rb', line 8
def self.mount_vmware_shared_folder(machine, name, guestpath, options)
owner = options[:owner]
group = options[:group]
machine.communicate.tap do |comm|
if owner.is_a? Integer
mount_uid = owner
else
mount_uid = "$(/usr/xpg4/bin/id -u #{owner})"
end
if group.is_a? Integer
mount_gid = group
else
mount_gid = "$(/bin/getent group #{group} | cut -d: -f3)"
end
if comm.test("test -L \"#{guestpath}\"", sudo: true)
comm.sudo("rm -f \"#{guestpath}\"")
end
if comm.test("test -d \"#{guestpath}\"", sudo: true)
comm.sudo("rm -Rf \"#{guestpath}\"")
end
parent_guest_path = File.dirname(guestpath)
if !comm.test("test -d \"#{parent_guest_path}\"", sudo: true)
comm.sudo("mkdir -p \"#{parent_guest_path}\"")
end
comm.sudo("ln -s \"/hgfs/#{name}\" \"#{guestpath}\"")
comm.sudo("chown -h #{mount_uid}:#{mount_gid} \"#{guestpath}\"")
end
end
|