Sha256: f34bbc2a3980a2dbb719798cd6ad615b8cc64ee4b1e0a9dadd311976c67a35b8

Contents?: true

Size: 1.23 KB

Versions: 16

Compression:

Stored size: 1.23 KB

Contents

require "vagrant/util/subprocess"
require "vagrant/util/which"

module VagrantPlugins
  module HostGentoo
    module Cap
      class NFS
        def self.nfs_check_command(env)
          if systemd?
            return "#{systemctl_path} status --no-pager nfs-server.service"
          else
            return "/etc/init.d/nfs status"
          end
        end

        def self.nfs_start_command(env)
          if systemd?
            return "#{systemctl_path} start rpcbind nfs-server.service"
          else
            return "/etc/init.d/nfs restart"
          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 self.systemd?
          result = Vagrant::Util::Subprocess.execute("ps", "-o", "comm=", "1")
          return result.stdout.chomp == "systemd"
        end

        def self.systemctl_path
          path = Vagrant::Util::Which.which("systemctl")
          return path if path

          folders = ["/usr/bin", "/usr/sbin"]
          folders.each do |folder|
            path = "#{folder}/systemctl"
            return path if File.file?(path)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
vagrant-unbundled-1.9.8.1 plugins/hosts/gentoo/cap/nfs.rb
vagrant-unbundled-1.9.7.1 plugins/hosts/gentoo/cap/nfs.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/hosts/gentoo/cap/nfs.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/hosts/gentoo/cap/nfs.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/hosts/gentoo/cap/nfs.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/plugins/hosts/gentoo/cap/nfs.rb
vagrant-unbundled-1.9.5.1 plugins/hosts/gentoo/cap/nfs.rb
vagrant-unbundled-1.9.1.1 plugins/hosts/gentoo/cap/nfs.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/hosts/gentoo/cap/nfs.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/hosts/gentoo/cap/nfs.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/hosts/gentoo/cap/nfs.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/hosts/gentoo/cap/nfs.rb
vagrant-unbundled-1.8.5.2 plugins/hosts/gentoo/cap/nfs.rb
vagrant-unbundled-1.8.5.1 plugins/hosts/gentoo/cap/nfs.rb
vagrant-unbundled-1.8.4.2 plugins/hosts/gentoo/cap/nfs.rb
vagrant-unbundled-1.8.4.1 plugins/hosts/gentoo/cap/nfs.rb