From 7bfc3ea16ed7a43c39efa5f960493e07142302e7 Mon Sep 17 00:00:00 2001 From: Tim Gus Date: Wed, 16 Oct 2013 01:04:21 -0400 Subject: [PATCH] hosts/gentoo: recognize systemd for nfsd startup and replace "service" command with /etc/init.d/nfs --- plugins/hosts/gentoo/host.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/hosts/gentoo/host.rb b/plugins/hosts/gentoo/host.rb index 58179441b..3ae961ce4 100644 --- a/plugins/hosts/gentoo/host.rb +++ b/plugins/hosts/gentoo/host.rb @@ -18,8 +18,20 @@ module VagrantPlugins super @nfs_apply_command = "/usr/sbin/exportfs -r" - @nfs_check_command = "service nfs status" - @nfs_start_command = "service nfs start" + if systemd? + @nfs_check_command = "/usr/bin/systemctl status nfsd" + @nfs_start_command = "/usr/bin/systemctl start nfsd rpc-mountd rpcbind" + else + @nfs_check_command = "/etc/init.d/nfs status" + @nfs_start_command = "/etc/init.d/nfs start" + end + end + + protected + + # Check for systemd presence from current processes. + def systemd? + `ps -o comm= 1`.chomp == 'systemd' end end end