2012-05-23 23:03:14 +00:00
|
|
|
require "vagrant"
|
|
|
|
|
|
|
|
require Vagrant.source_root.join("plugins/hosts/linux/host")
|
|
|
|
|
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?
|
2012-10-26 18:15:58 +00:00
|
|
|
File.exist?("/etc/arch-release")
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.nfs?
|
|
|
|
# HostLinux checks for nfsd which returns false unless the
|
|
|
|
# services are actively started. This leads to a misleading
|
|
|
|
# error message. Checking for nfs (no d) seems to work
|
|
|
|
# regardless. Also fixes useless use of cat, regex, and
|
|
|
|
# redirection.
|
|
|
|
Kernel.system("grep -Fq nfs /proc/filesystems")
|
2011-12-12 07:22:44 +00:00
|
|
|
end
|
|
|
|
|
2012-01-25 18:39:17 +00:00
|
|
|
# Normal, mid-range precedence.
|
|
|
|
def self.precedence
|
|
|
|
5
|
|
|
|
end
|
|
|
|
|
2013-09-17 04:27:15 +00:00
|
|
|
def initialize
|
2012-09-19 05:26:51 +00:00
|
|
|
if systemd?
|
2013-09-17 04:27:15 +00:00
|
|
|
@nfs_check_command = "/usr/sbin/systemctl status nfsd"
|
|
|
|
@nfs_start_command = "/usr/sbin/systemctl start nfsd rpc-idmapd rpc-mountd rpcbind"
|
2012-09-19 05:26:51 +00:00
|
|
|
else
|
2013-09-17 04:27:15 +00:00
|
|
|
@nfs_check_command = "/etc/rc.d/nfs-server status"
|
|
|
|
@nfs_start_command = "sh -c 'for s in {rpcbind,nfs-common,nfs-server}; do /etc/rc.d/$s start; done'"
|
2012-09-19 05:26:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
# This tests to see if systemd is used on the system. This is used
|
|
|
|
# in newer versions of Arch, and requires a change in behavior.
|
|
|
|
def systemd?
|
2012-10-26 18:16:04 +00:00
|
|
|
`ps -o comm= 1`.chomp == 'systemd'
|
2011-04-19 16:35:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|