From e90bbdbfbb9ca5c58f364a2081d2b130ab3fbd66 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Fri, 10 Jun 2022 13:58:09 -0400 Subject: [PATCH] guest: add Alma Linux support This hasn't landed upstream yet in Vagrant, but this just anticipates it existing in the future. --- .../cap/guest/alma/sshfs_client.rb | 39 +++++++++++++++++++ lib/vagrant-sshfs/plugin.rb | 10 +++++ 2 files changed, 49 insertions(+) create mode 100644 lib/vagrant-sshfs/cap/guest/alma/sshfs_client.rb diff --git a/lib/vagrant-sshfs/cap/guest/alma/sshfs_client.rb b/lib/vagrant-sshfs/cap/guest/alma/sshfs_client.rb new file mode 100644 index 0000000..d6410ca --- /dev/null +++ b/lib/vagrant-sshfs/cap/guest/alma/sshfs_client.rb @@ -0,0 +1,39 @@ +module VagrantPlugins + module GuestAlma + module Cap + class SSHFSClient + def self.sshfs_install(machine) + + case machine.guest.capability("flavor") + when :alma_8 + # No need to install epel. fuse-sshfs comes from the powertools repo + # https://bugzilla.redhat.com/show_bug.cgi?id=1758884 + # https://github.com/dustymabe/vagrant-sshfs/issues/123 + machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs") + when :alma_9, :alma # alma9 or unknown + # Install fuse-sshfs from epel + 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 929ce72..8b35663 100644 --- a/lib/vagrant-sshfs/plugin.rb +++ b/lib/vagrant-sshfs/plugin.rb @@ -117,6 +117,16 @@ class Plugin < Vagrant.plugin("2") VagrantPlugins::GuestRocky::Cap::SSHFSClient end + guest_capability("alma", "sshfs_installed") do + require_relative "cap/guest/alma/sshfs_client" + VagrantPlugins::GuestAlma::Cap::SSHFSClient + end + + guest_capability("alma", "sshfs_install") do + require_relative "cap/guest/alma/sshfs_client" + VagrantPlugins::GuestAlma::Cap::SSHFSClient + end + guest_capability("fedora", "sshfs_installed") do require_relative "cap/guest/fedora/sshfs_client" VagrantPlugins::GuestFedora::Cap::SSHFSClient