Fixes #10170: Check for modinfo in /sbin

This commit is contained in:
Jeff Bonhag 2019-11-05 11:55:52 -05:00
parent f30b136c57
commit a742476305
1 changed files with 12 additions and 1 deletions

View File

@ -93,7 +93,7 @@ module VagrantPlugins
"systemctl --no-pager --no-legend --plain list-unit-files --all --type=service " \
"| grep #{nfs_service_name_systemd}").exit_code == 0
else
Vagrant::Util::Subprocess.execute("modinfo", "nfsd").exit_code == 0 ||
Vagrant::Util::Subprocess.execute(modinfo_path, "nfsd").exit_code == 0 ||
Vagrant::Util::Subprocess.execute("grep", "nfsd", "/proc/filesystems").exit_code == 0
end
end
@ -261,6 +261,17 @@ module VagrantPlugins
Vagrant::Util::Subprocess.execute(*Shellwords.split(check_command)).exit_code == 0
end
def self.modinfo_path
path = Vagrant::Util::Which.which("modinfo")
return path if path
folders = ["/sbin"]
folders.each do |folder|
path = "#{folder}/modinfo"
return path if File.file?(path)
end
end
# @private
# Reset the cached values for capability. This is not considered a public
# API and should only be used for testing.