blob: 18df015fd236968b211cccc27eb98a1a9d495153 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
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
should = @resource.should(:ensure)
if @resource[:source] =~ /\/$/
if @resource[:source] =~ /^(ftp|https?):/
withenv :PACKAGESITE => @resource[:source] do
pkgadd "-r", @resource[:name]
end
else
withenv :PKG_PATH => @resource[:source] do
pkgadd @resource[:name]
end
end
else
if @resource[:source]
Puppet.warning "source is defined but does not have trailing slash, ignoring %s" % @resource[:source]
end
pkgadd "-r", @resource[:name]
end
end
def query
self.class.instances.each do |provider|
if provider.name == @resource.name
return provider.properties
end
end
return nil
end
def uninstall
pkgdelete "%s-%s" % [@resource[:name], @resource.should(:ensure)]
end
end
|