class Chef::Resource::FreebsdPackage

Public Instance Methods

after_created() click to toggle source

make sure we assign the appropriate underlying providers based on what package managers exist on this FreeBSD system or the source of the package

@return [void]

# File lib/chef/resource/freebsd_package.rb, line 41
def after_created
  assign_provider
end
supports_pkgng?() click to toggle source

Is the system at least version 1000017 or is the make variable WITH_PKGNG set

@return [Boolean] do we support pkgng

# File lib/chef/resource/freebsd_package.rb, line 48
def supports_pkgng?
  ships_with_pkgng? || !!shell_out_compact!("make", "-V", "WITH_PKGNG", :env => nil).stdout.match(/yes/i)
end

Private Instance Methods

assign_provider() click to toggle source
# File lib/chef/resource/freebsd_package.rb, line 60
def assign_provider
  @provider = if source.to_s =~ /^ports$/i
                Chef::Provider::Package::Freebsd::Port
              elsif supports_pkgng?
                Chef::Provider::Package::Freebsd::Pkgng
              else
                Chef::Provider::Package::Freebsd::Pkg
              end
end
ships_with_pkgng?() click to toggle source

It was not until __FreeBSD_version 1000017 that pkgng became the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'.

# File lib/chef/resource/freebsd_package.rb, line 56
def ships_with_pkgng?
  node[:os_version].to_i >= 1000017
end