Sha256: 7415bbbdc9b3a6edb68be8400a4042c9cc147b639edf69f18203e55d7d7e2c0b

Contents?: true

Size: 1.46 KB

Versions: 63

Compression:

Stored size: 1.46 KB

Contents

module VagrantPlugins
  module GuestSolaris
    module Cap
      class MountVirtualBoxSharedFolder
        def self.mount_virtualbox_shared_folder(machine, name, guestpath, options)
          # These are just far easier to use than the full options syntax
          owner = options[:owner]
          group = options[:group]

          # Create the shared folder
          machine.communicate.execute("#{machine.config.solaris.suexec_cmd} mkdir -p #{guestpath}")

          if owner.is_a? Integer
            mount_uid = owner
          else
            # We have to use this `id` command instead of `/usr/bin/id` since this
            # one accepts the "-u" and "-g" flags.
            mount_uid = "`/usr/xpg4/bin/id -u #{owner}`"
          end

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

          # Mount the folder with the proper owner/group
          mount_options = "-o uid=#{mount_uid},gid=#{mount_gid}"
          if options[:mount_options]
            mount_options += ",#{options[:mount_options].join(",")}"
          end

          machine.communicate.execute("#{machine.config.solaris.suexec_cmd} /sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}")

          # chown the folder to the proper owner/group
          machine.communicate.execute("#{machine.config.solaris.suexec_cmd} chown #{mount_uid}:#{mount_gid} #{guestpath}")
        end
      end
    end
  end
end

Version data entries

63 entries across 56 versions & 8 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.3.3.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.3.2.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.19.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.18.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.16.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.14.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.10.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.9.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.8.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.7.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.6.2 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.6.1 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.6.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.5.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.4.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.3.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb
vagrant-unbundled-2.2.2.0 plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb