diff --git a/lib/vagrant-sshfs/cap/guest/centos/sshfs_client.rb b/lib/vagrant-sshfs/cap/guest/centos/sshfs_client.rb new file mode 100644 index 0000000..21c54c8 --- /dev/null +++ b/lib/vagrant-sshfs/cap/guest/centos/sshfs_client.rb @@ -0,0 +1,35 @@ +module VagrantPlugins + module GuestCentos + module Cap + class SSHFSClient + def self.sshfs_install(machine) + + case machine.guest.capability("flavor") + when :centos_8 + machine.communicate.sudo("yum -y install --enablerepo=PowerTools fuse-sshfs") + when :centos_7, :centos + if !epel_installed(machine) + epel_install(machine) + end + machine.communicate.sudo("yum -y install fuse-sshfs") + end + end + + def self.sshfs_installed(machine) + machine.communicate.test("rpm -q fuse-sshfs") + end + + protected + + def self.epel_installed(machine) + machine.communicate.test("rpm -q epel-release") + end + + def self.epel_install(machine) + machine.communicate.sudo("yum -y install epel-release") + end + + end + end + end +end diff --git a/lib/vagrant-sshfs/plugin.rb b/lib/vagrant-sshfs/plugin.rb index 69abc04..2958a84 100644 --- a/lib/vagrant-sshfs/plugin.rb +++ b/lib/vagrant-sshfs/plugin.rb @@ -97,6 +97,16 @@ class Plugin < Vagrant.plugin("2") VagrantPlugins::GuestRedHat::Cap::SSHFSClient end + guest_capability("centos", "sshfs_installed") do + require_relative "cap/guest/centos/sshfs_client" + VagrantPlugins::GuestCentos::Cap::SSHFSClient + end + + guest_capability("centos", "sshfs_install") do + require_relative "cap/guest/centos/sshfs_client" + VagrantPlugins::GuestCentos::Cap::SSHFSClient + end + guest_capability("fedora", "sshfs_installed") do require_relative "cap/guest/fedora/sshfs_client" VagrantPlugins::GuestFedora::Cap::SSHFSClient