vagrant/plugins/hosts/redhat/host.rb
oss-core-libraries-dashboard[bot] 73228596f4
[COMPLIANCE] Update Copyright and License Headers (Batch 3 of 7) (#13763)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2025-12-22 16:46:39 +05:30

31 lines
861 B
Ruby

# Copyright IBM Corp. 2010, 2025
# SPDX-License-Identifier: BUSL-1.1
require "pathname"
module VagrantPlugins
module HostRedHat
class Host < Vagrant.plugin("2", :host)
def detect?(env)
release_file = Pathname.new("/etc/redhat-release")
if release_file.exist?
release_file.open("r:ISO-8859-1:UTF-8") do |f|
contents = f.gets
return true if contents =~ /^CentOS/ # CentOS
return true if contents =~ /^Fedora/ # Fedora
return true if contents =~ /^Korora/ # Korora
# Oracle Linux < 5.3
return true if contents =~ /^Enterprise Linux Enterprise Linux/
# Red Hat Enterprise Linux and Oracle Linux >= 5.3
return true if contents =~ /^Red Hat Enterprise Linux/
end
end
false
end
end
end
end