diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-18 21:07:01 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-18 21:07:01 +0000 |
| commit | 4cb30eb103281887aecbc38ca56a71c508d959d3 (patch) | |
| tree | 0947012bf491fbb3736835637903ef59f6e87617 | |
| parent | 099bf6c582b8e68263f25c0430fcf3d5ac7b1b7f (diff) | |
| download | puppet-4cb30eb103281887aecbc38ca56a71c508d959d3.tar.gz puppet-4cb30eb103281887aecbc38ca56a71c508d959d3.tar.xz puppet-4cb30eb103281887aecbc38ca56a71c508d959d3.zip | |
Adding fink package provider.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2617 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | CHANGELOG | 2 | ||||
| -rwxr-xr-x | lib/puppet/provider/package/fink.rb | 87 |
2 files changed, 89 insertions, 0 deletions
@@ -1,3 +1,5 @@ + Added fink package provider (#642), as provided by 'do'. + Marked the dpkg package provider as versionable (#647). Applied patches by trombik to fix FreeBSD ports (#624 and #628). diff --git a/lib/puppet/provider/package/fink.rb b/lib/puppet/provider/package/fink.rb new file mode 100755 index 000000000..4bc857458 --- /dev/null +++ b/lib/puppet/provider/package/fink.rb @@ -0,0 +1,87 @@ +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" + + defaultfor :operatingsystem => :darwin + + 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 + if @resource[:responsefile] + self.run_preseed + end + should = @resource.should(:ensure) + + str = @resource[:name] + case should + when true, false, Symbol + # pass + else + # Add the package version + str += "=%s" % 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 %s to debconf-set-selections" % response) + + 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 + +# $Id$ |
