28
28
require 'puppet/provider/package'
30
30
Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Package do
31
desc "Package management based on Apple's Installer.app and DiskUtility.app
33
Author: Jeff McCune <jeff@northstarlabs.net>
35
Please direct questions about this provider to the puppet-users mailing list.
37
This package works by checking the contents of a DMG image for Apple pkg or
38
mpkg files. Any number of pkg or mpkg files may exist in the root directory of
39
the DMG file system. Sub directories are not checked for packages.
41
This provider always assumes the label (formerly called 'name') attribute
42
declared in the manifest will always exactly match the file name (without
43
path) of the DMG file itself. Therefore, if you want to install packages in
44
'Foobar.pkg.dmg' you must explicitly specify the label::
46
package { Foobar.pkg.dmg: ensure => installed, provider => pkgdmg }
48
Only the dmg file name itself is used when puppet determines if the packages
49
contained within are currently installed. For example, if a package resource
50
named 'Foobar.pkg.dmg' is named for installation and contains multiple
51
packages, this provider will install all packages in the root directory of
52
this file system, then create a small cookie for the whole bundle, located at
53
/var/db/.puppet_pkgdmg_installed_Foobar.pkg.dmg
55
As a result, if you change the contents of the DMG file in any way, Puppet
56
will not update or re-install the packages contained within unless you change
57
the file name of the DMG wrapper itself. Therefore, if you use this provider,
58
I recommend you name the DMG wrapper files in a manner that lends itself to
59
incremental version changes. I include some version or date string in the DMG
62
Firefox-2.0.0.3-1.pkg.dmg
64
If I realize I've mis-packaged this DMG, then I have the option to increment
65
the package version, yielding Firefox-2.0.0.3-2.pkg.dmg.
67
This provider allows you to host DMG files within an FTP or HTTP server. This
68
is primarily how the author provider distributes software. Any URL mechanism
69
curl or Ruby's open-uri module supports is supported by this provider. Curl
70
supported URL's yield much faster data throughput than open-uri, so I
71
recommend HTTP, HTTPS, or FTP for source package repositories.
73
Because the provider assumes packages will be transfered via CURL, a two stage
74
process occurs. First, if a URL is detected, curl is invoked to transfer the
75
file into a temporary directory. If no URL is present, the provider skips
76
straight to step 2. In step two, the source file is mounted, then packages
77
installed, and finally the DMG file is removed.
79
If this is a problem for you, please patch the code, or bug Jeff to fix this.
83
package { Thunderbird-2.0.0.4-1.pkg.dmg:
84
provider => pkgdmg, ensure => present
85
source => 'http://0.0.0.0:8000/packages/Thunderbird-2.0.0.4-1.pkg.dmg',
88
**WARNING**: Because I assume files will be downloaded to /tmp, the current
89
implementation attempts to delete DMG files if you install directly from the
90
file system and not via a URL method."
31
desc "Package management based on Apple's Installer.app and DiskUtility.app. This package works by checking the contents of a DMG image for Apple pkg or mpkg files. Any number of pkg or mpkg files may exist in the root directory of the DMG file system. Sub directories are not checked for packages. See `the wiki docs </trac/puppet/wiki/DmgPackages>` for more detail."
92
33
confine :exists => "/Library/Receipts"
93
34
commands :installer => "/usr/sbin/installer"