Sha256: ece843d38099259e0256c99f297c333d871e68b68f3eab5719c0fbc162cffa90

Contents?: true

Size: 1.82 KB

Versions: 164

Compression:

Stored size: 1.82 KB

Contents

Puppet::Type.type(:package).provide :fink, :parent => :dpkg, :source => :dpkg do
  # Provide sorting functionality
  include Puppet::Util::Package

  desc "Package management via `fink`."

  commands :fink => "/sw/bin/fink"
  commands :aptget => "/sw/bin/apt-get"
  commands :aptcache => "/sw/bin/apt-cache"
  commands :dpkgquery => "/sw/bin/dpkg-query"

  has_feature :versionable

  # A derivative of DPKG; this is how most people actually manage
  # Debian boxes, and the only thing that differs is that it can
  # install packages from remote sites.

  def finkcmd(*args)
    fink(*args)
  end

  # Install a package using 'apt-get'.  This function needs to support
  # installing a specific version.
  def install
    self.run_preseed if @resource[:responsefile]
    should = @resource.should(:ensure)

    str = @resource[:name]
    case should
    when true, false, Symbol
      # pass
    else
      # Add the package version
      str += "=#{should}"
    end
    cmd = %w{-b -q -y}

    cmd << :install << str

    finkcmd(cmd)
  end

  # What's the latest package version available?
  def latest
    output = aptcache :policy,  @resource[:name]

    if output =~ /Candidate:\s+(\S+)\s/
      return $1
    else
      self.err "Could not find latest version"
      return nil
    end
  end

  #
  # preseeds answers to dpkg-set-selection from the "responsefile"
  #
  def run_preseed
    if response = @resource[:responsefile] and Puppet::FileSystem.exist?(response)
      self.info("Preseeding #{response} to debconf-set-selections")

      preseed response
    else
      self.info "No responsefile specified or non existent, not preseeding anything"
    end
  end

  def update
    self.install
  end

  def uninstall
    finkcmd "-y", "-q", :remove, @model[:name]
  end

  def purge
    aptget '-y', '-q', 'remove', '--purge', @resource[:name]
  end
end

Version data entries

164 entries across 164 versions & 2 rubygems

Version Path
puppet-4.10.4-universal-darwin lib/puppet/provider/package/fink.rb
puppet-retrospec-1.4.1 vendor/gems/puppet-4.5.2/lib/puppet/provider/package/fink.rb
puppet-4.10.1 lib/puppet/provider/package/fink.rb
puppet-4.10.1-x86-mingw32 lib/puppet/provider/package/fink.rb
puppet-4.10.1-x64-mingw32 lib/puppet/provider/package/fink.rb
puppet-4.10.1-universal-darwin lib/puppet/provider/package/fink.rb
puppet-retrospec-1.4.0 vendor/gems/puppet-4.5.2/lib/puppet/provider/package/fink.rb
puppet-4.10.0 lib/puppet/provider/package/fink.rb
puppet-4.10.0-x86-mingw32 lib/puppet/provider/package/fink.rb
puppet-4.10.0-x64-mingw32 lib/puppet/provider/package/fink.rb
puppet-4.10.0-universal-darwin lib/puppet/provider/package/fink.rb
puppet-retrospec-1.3.2 vendor/gems/puppet-4.5.2/lib/puppet/provider/package/fink.rb
puppet-4.9.4 lib/puppet/provider/package/fink.rb
puppet-4.9.4-x86-mingw32 lib/puppet/provider/package/fink.rb
puppet-4.9.4-x64-mingw32 lib/puppet/provider/package/fink.rb
puppet-4.9.4-universal-darwin lib/puppet/provider/package/fink.rb
puppet-retrospec-1.3.1 vendor/gems/puppet-4.5.2/lib/puppet/provider/package/fink.rb
puppet-4.9.3 lib/puppet/provider/package/fink.rb
puppet-4.9.3-x86-mingw32 lib/puppet/provider/package/fink.rb
puppet-4.9.3-x64-mingw32 lib/puppet/provider/package/fink.rb