32 lines
999 B
Ruby
32 lines
999 B
Ruby
module Vagrant
|
|
module Hosts
|
|
# Represents a BSD host, such as FreeBSD and Darwin (Mac OS X).
|
|
class BSD < Base
|
|
include Util
|
|
|
|
def nfs?
|
|
system("which nfsd")
|
|
$?.to_i == 0
|
|
end
|
|
|
|
def nfs_export(ip, folders)
|
|
output = TemplateRenderer.render('nfs/exports',
|
|
:uuid => env.vm.uuid,
|
|
:ip => ip,
|
|
:folders => folders)
|
|
|
|
env.logger.info "Preparing to edit /etc/exports. Administrator priveleges will be required..."
|
|
output.split("\n").each do |line|
|
|
# This should only ask for administrative permission once, even
|
|
# though its executed in multiple subshells.
|
|
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
|
|
end
|
|
|
|
# We run restart here instead of "update" just in case nfsd
|
|
# is not starting
|
|
system("sudo nfsd restart")
|
|
end
|
|
end
|
|
end
|
|
end
|