From 690551348103190eab0bf2cc02a6733096bff2b0 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Fri, 26 Oct 2012 14:15:58 -0400 Subject: [PATCH 1/2] Fix match? and nfs? for Arch host --- plugins/hosts/arch/host.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/hosts/arch/host.rb b/plugins/hosts/arch/host.rb index fe56f31f1..cb96cce89 100644 --- a/plugins/hosts/arch/host.rb +++ b/plugins/hosts/arch/host.rb @@ -6,7 +6,16 @@ module VagrantPlugins module HostArch class Host < VagrantPlugins::HostLinux::Host def self.match? - File.exist?("/etc/rc.conf") && File.exist?("/etc/pacman.conf") + 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") end # Normal, mid-range precedence. From 8c7c345bc0044e3b15ecfb9b89a435a6c04e43d9 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Fri, 26 Oct 2012 14:16:04 -0400 Subject: [PATCH 2/2] Use a better check for systemd Using `which systemctl` would return true on even non-systemd machines during this transitional time. --- plugins/hosts/arch/host.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hosts/arch/host.rb b/plugins/hosts/arch/host.rb index cb96cce89..d6aec2b74 100644 --- a/plugins/hosts/arch/host.rb +++ b/plugins/hosts/arch/host.rb @@ -61,7 +61,7 @@ module VagrantPlugins # 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? - Kernel.system("which systemctl &>/dev/null") + `ps -o comm= 1`.chomp == 'systemd' end end end