Sha256: 2e03988cec69ad4df27ea01f80e5ae021d928183be5b1d052ffacf381aebf244

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# Copyright (c) 2020 Olexander Grynchuk
module Vagrant
  module FreeBSD
    module Cap
      class MountVmwareSharedFolder

        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 = "`id -u #{owner}`"
            end

            if group.is_a? Integer
              mount_gid = group
            else
              mount_gid = "`id -g #{group}`"
            end


            # create guest parent folder if doesn't exist
            parent_guest_path = File.dirname(guestpath)
            if !comm.test("test -d \"#{parent_guest_path}\"", sudo: true)
              comm.sudo("mkdir -p \"#{parent_guest_path}\"")
            end
#vmhgfs-fuse -o uid=`id -u vagrant`,gid=`id -u vagrant`,allow_other .host:/-workspace #$app_dir
            # Set permissions correctly on the link
            comm.sudo("vmhgfs-fuse -o uid=#{mount_uid},gid=#{mount_gid},allow_other .host:/#{name} \"#{guestpath}\"")
          end
        end
        
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-freebsd-0.0.1 lib/vagrant-freebsd/cap/mount_vmware_shared_folder.rb