Sha256: 669e93e22df8ef202537924416f2de3f2ff5344565a57e2f3f4630908c98edd6

Contents?: true

Size: 1.83 KB

Versions: 67

Compression:

Stored size: 1.83 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}

    keep = ""

    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 FileTest.exists?(response)
      self.info("Preseeding #{response} to debconf-set-selections")

      preseed response
    else
      self.info "No responsefile specified or non existant, 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

67 entries across 67 versions & 4 rubygems

Version Path
puppet-parse-0.1.4 lib/vendor/puppet/provider/package/fink.rb
puppet-parse-0.1.3 lib/vendor/puppet/provider/package/fink.rb
puppet-parse-0.1.2 lib/vendor/puppet/provider/package/fink.rb
puppet-parse-0.1.1 lib/vendor/puppet/provider/package/fink.rb
puppet-2.7.26 lib/puppet/provider/package/fink.rb
puppet-2.7.25 lib/puppet/provider/package/fink.rb
puppet-2.7.24 lib/puppet/provider/package/fink.rb
puppet-3.2.4 lib/puppet/provider/package/fink.rb
puppet-2.7.23 lib/puppet/provider/package/fink.rb
puppet-3.2.3 lib/puppet/provider/package/fink.rb
puppet-3.2.3.rc1 lib/puppet/provider/package/fink.rb
puppet-3.2.2 lib/puppet/provider/package/fink.rb
puppet-2.7.22 lib/puppet/provider/package/fink.rb
puppet-3.2.1 lib/puppet/provider/package/fink.rb
puppet-3.2.1.rc1 lib/puppet/provider/package/fink.rb
puppet-3.2.0.rc2 lib/puppet/provider/package/fink.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/provider/package/fink.rb
puppet-3.2.0.rc1 lib/puppet/provider/package/fink.rb
puppet-parse-0.1.0 lib/vendor/puppet/provider/package/fink.rb
puppet-parse-0.0.6 lib/vendor/puppet/provider/package/fink.rb