Sha256: 8ba467a122cdadd7e7cea4e05dc59277a94834acfba18ee844651cf2443e5bc5

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 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 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

6 entries across 3 versions & 2 rubygems

Version Path
vagrant-unbundled-1.8.1.2 plugins/hosts/gentoo/cap/nfs.rb
vagrant-unbundled-1.8.1.1 plugins/hosts/gentoo/cap/nfs.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/hosts/gentoo/cap/nfs.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/plugins/hosts/gentoo/cap/nfs.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/hosts/gentoo/cap/nfs.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/hosts/gentoo/cap/nfs.rb