Module: Omnibus::Packager

Includes:
Logging, Sugarable
Defined in:
lib/omnibus/packager.rb

Defined Under Namespace

Classes: APPX, BFF, Base, DEB, IPS, MSI, Makeself, PKG, PKGSRC, RPM, Solaris, WindowsBase

Constant Summary collapse

PLATFORM_PACKAGER_MAP =

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

Returns:

  • (Hash<String, Class>)
{
  "debian" => DEB,
  "fedora" => RPM,
  "suse" => RPM,
  "rhel" => RPM,
  "wrlinux" => RPM,
  "amazon" => RPM,
  "rocky"  => RPM,
  "aix" => BFF,
  "solaris" => Solaris,
  "omnios" => IPS,
  "ips" => IPS,
  "windows" => [MSI, APPX],
  "mac_os_x" => PKG,
  "smartos" => PKGSRC,
}.freeze

Class Method Summary collapse

Methods included from Sugarable

extended, included, #node

Methods included from Logging

included

Class Method Details

.for_current_system[~Packager::Base]

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

Examples:

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

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 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