Skip to content

Commit

Permalink
Added Arch Linux as under vagrant/hosts
Browse files Browse the repository at this point in the history
Added NFS support for Arch Linux under vagrant/hosts by adding
vagrant/hosts/arch and a platform test for Arch Linux.
  • Loading branch information
TimDumol authored and mitchellh committed Apr 20, 2011
1 parent 33f5e2e commit 2c091c9
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/vagrant/hosts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ module Hosts
autoload :Base, 'vagrant/hosts/base'
autoload :BSD, 'vagrant/hosts/bsd'
autoload :Linux, 'vagrant/hosts/linux'
autoload :Arch, 'vagrant/hosts/arch'
end
end
27 changes: 27 additions & 0 deletions lib/vagrant/hosts/arch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module Vagrant
module Hosts
class Arch < Linux
def nfs_export(ip, folders)
output = TemplateRenderer.render('nfs/exports_linux',
:uuid => env.vm.uuid,
:ip => ip,
:folders => folders)

env.ui.info I18n.t("vagrant.hosts.arch.nfs_export.prepare")
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
1 change: 1 addition & 0 deletions lib/vagrant/hosts/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def detect
classes = {
:darwin => BSD,
:bsd => BSD,
:arch => Arch,
:linux => Linux
}

Expand Down
5 changes: 5 additions & 0 deletions lib/vagrant/util/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def windows?
false
end

def arch?
linux?() and File.exist?('/etc/rc.conf') and
File.exist?('/etc/pacman.conf') and File.exist?('/etc/rc.d/')
end

# Returns boolean noting whether this is a 64-bit CPU. This
# is not 100% accurate and there could easily be false negatives.
#
Expand Down
4 changes: 4 additions & 0 deletions templates/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ en:
nfs_export:
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."

arch:
nfs_export:
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."

provisioners:
chef:
json: "Generating chef JSON and uploading..."
Expand Down

0 comments on commit 2c091c9

Please sign in to comment.