Method: Vagrant::Guest::Solaris#mount_shared_folder

Defined in:
lib/vagrant/guest/solaris.rb

#mount_shared_folder(name, guestpath, options) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/vagrant/guest/solaris.rb', line 96

def mount_shared_folder(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
  vm.channel.execute("#{vm.config.solaris.suexec_cmd} 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]
  vm.channel.execute("#{vm.config.solaris.suexec_cmd} /sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}")

  # chown the folder to the proper owner/group
  vm.channel.execute("#{vm.config.solaris.suexec_cmd} chown `#{id_cmd} -u #{owner}`:`#{id_cmd} -g #{group}` #{guestpath}")
end