module Omnibus::Packager

Constants

PLATFORM_PACKAGER_MAP

The list of Ohai platform families mapped to the respective packager class.

@return [Hash<String, Class>]

Public Class Methods

for_current_system() click to toggle source

Determine the packager(s) for the current system. This method returns the class, not an instance of the class.

@example

Packager.for_current_system #=> [Packager::RPM]

@return [[~Packager::Base]]

# File lib/omnibus/packager.rb, line 66
def for_current_system
  family = Ohai["platform_family"]
  version = Ohai["platform_version"]

  if family == "solaris2" && ChefUtils::VersionString.new(version).satisfies?(">= 5.11")
    family = "ips"
  elsif family == "solaris2" && ChefUtils::VersionString.new(version).satisfies?(">= 5.10")
    family = "solaris"
  end
  if klass = PLATFORM_PACKAGER_MAP[family]
    klass.is_a?(Array) ? klass : [ klass ]
  else
    log.warn(log_key) do
      "Could not determine packager for `#{family}`, defaulting to `makeself`!"
    end
    [Makeself]
  end
end

Private Instance Methods

for_current_system() click to toggle source

Determine the packager(s) for the current system. This method returns the class, not an instance of the class.

@example

Packager.for_current_system #=> [Packager::RPM]

@return [[~Packager::Base]]

# File lib/omnibus/packager.rb, line 66
def for_current_system
  family = Ohai["platform_family"]
  version = Ohai["platform_version"]

  if family == "solaris2" && ChefUtils::VersionString.new(version).satisfies?(">= 5.11")
    family = "ips"
  elsif family == "solaris2" && ChefUtils::VersionString.new(version).satisfies?(">= 5.10")
    family = "solaris"
  end
  if klass = PLATFORM_PACKAGER_MAP[family]
    klass.is_a?(Array) ? klass : [ klass ]
  else
    log.warn(log_key) do
      "Could not determine packager for `#{family}`, defaulting to `makeself`!"
    end
    [Makeself]
  end
end