2012-04-19 05:20:45 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module HostArch
|
|
|
|
class Host < VagrantPlugins::HostLinux::Host
|
2011-12-12 07:22:44 +00:00
|
|
|
def self.match?
|
|
|
|
File.exist?("/etc/rc.conf") && File.exist?("/etc/pacman.conf")
|
|
|
|
end
|
|
|
|
|
2012-01-25 18:39:17 +00:00
|
|
|
# Normal, mid-range precedence.
|
|
|
|
def self.precedence
|
|
|
|
5
|
|
|
|
end
|
|
|
|
|
2011-12-12 07:22:44 +00:00
|
|
|
def nfs_export(id, ip, folders)
|
2011-04-19 16:35:20 +00:00
|
|
|
output = TemplateRenderer.render('nfs/exports_linux',
|
2011-12-12 07:22:44 +00:00
|
|
|
:uuid => id,
|
2011-04-19 16:35:20 +00:00
|
|
|
:ip => ip,
|
|
|
|
:folders => folders)
|
|
|
|
|
2011-12-12 07:22:44 +00:00
|
|
|
@ui.info I18n.t("vagrant.hosts.arch.nfs_export.prepare")
|
2011-04-19 16:35:20 +00:00
|
|
|
sleep 0.5
|
|
|
|
|
|
|
|
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 /etc/rc.d/rpcbind restart")
|
|
|
|
system("sudo /etc/rc.d/nfs-common restart")
|
|
|
|
system("sudo /etc/rc.d/nfs-server restart")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|