Sha256: 8e52ae7eaae7daf069587603fdc1bc711351862f8375d6d50d47811918d3df11

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

# A general Vagrant system implementation for "solaris 11".
#
# Contributed by Jan Thomas Moldung <janth@moldung.no>

module VagrantPlugins
  module GuestSolaris11
    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.sudo("mkdir -p #{guestpath}")

          # We have to use this `id` command instead of `/usr/bin/id` since this
          # one accepts the "-u" and "-g" flags.
          id_cmd        = "/usr/xpg4/bin/id"

          # Mount the folder with the proper owner/group
          mount_options = "-o uid=`#{id_cmd} -u #{owner}`,gid=`#{id_cmd} -g #{group}`"
          mount_options += ",#{options[:extra]}" if options[:extra]
          machine.communicate.sudo("/sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}")

          # chown the folder to the proper owner/group
          machine.communicate.sudo("chown `#{id_cmd} -u #{owner}`:`#{id_cmd} -g #{group}` #{guestpath}")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-guests-solaris11-0.0.1a lib/vagrant-guests-solaris11/cap/mount_virtualbox_shared_folder.rb
vagrant-guests-solaris11-0.0.1.dev lib/vagrant-guests-solaris11/cap/mount_virtualbox_shared_folder.rb