Sha256: c9c5a965a30e7d7c49fd6a824d2cc2188e5f3a23295b9907dcf6cebe77fd3a72

Contents?: true

Size: 1.34 KB

Versions: 246

Compression:

Stored size: 1.34 KB

Contents

Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
  desc "The specific form of package management on FreeBSD.  This is an
    extremely quirky packaging system, in that it freely mixes between
    ports and packages.  Apparently all of the tools are written in Ruby,
    so there are plans to rewrite this support to directly use those
    libraries."

  commands :pkginfo => "/usr/sbin/pkg_info",
    :pkgadd => "/usr/sbin/pkg_add",
    :pkgdelete => "/usr/sbin/pkg_delete"

  confine :operatingsystem => :freebsd

  def self.listcmd
    command(:pkginfo)
  end

  def install
    if @resource[:source] =~ /\/$/
      if @resource[:source] =~ /^(ftp|https?):/
        Puppet::Util.withenv :PACKAGESITE => @resource[:source] do
          pkgadd "-r", @resource[:name]
        end
      else
        Puppet::Util.withenv :PKG_PATH => @resource[:source] do
          pkgadd @resource[:name]
        end
      end
    else
      Puppet.warning "source is defined but does not have trailing slash, ignoring #{@resource[:source]}" if @resource[:source]
      pkgadd "-r", @resource[:name]
    end
  end

  def query
    self.class.instances.each do |provider|
      if provider.name == @resource.name
        return provider.properties
      end
    end
    nil
  end

  def uninstall
    pkgdelete "#{@resource[:name]}-#{@resource.should(:ensure)}"
  end
end

Version data entries

246 entries across 246 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/provider/package/freebsd.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/provider/package/freebsd.rb
puppet-4.10.12 lib/puppet/provider/package/freebsd.rb
puppet-4.10.12-x86-mingw32 lib/puppet/provider/package/freebsd.rb
puppet-4.10.12-x64-mingw32 lib/puppet/provider/package/freebsd.rb
puppet-4.10.12-universal-darwin lib/puppet/provider/package/freebsd.rb
puppet-4.10.11 lib/puppet/provider/package/freebsd.rb
puppet-4.10.11-x86-mingw32 lib/puppet/provider/package/freebsd.rb
puppet-4.10.11-x64-mingw32 lib/puppet/provider/package/freebsd.rb
puppet-4.10.11-universal-darwin lib/puppet/provider/package/freebsd.rb
puppet-4.10.10 lib/puppet/provider/package/freebsd.rb
puppet-4.10.10-x86-mingw32 lib/puppet/provider/package/freebsd.rb
puppet-4.10.10-x64-mingw32 lib/puppet/provider/package/freebsd.rb
puppet-4.10.10-universal-darwin lib/puppet/provider/package/freebsd.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/provider/package/freebsd.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/provider/package/freebsd.rb
puppet-4.10.9 lib/puppet/provider/package/freebsd.rb
puppet-4.10.9-x86-mingw32 lib/puppet/provider/package/freebsd.rb
puppet-4.10.9-x64-mingw32 lib/puppet/provider/package/freebsd.rb
puppet-4.10.9-universal-darwin lib/puppet/provider/package/freebsd.rb