~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to lib/puppet/provider/package/pkgdmg.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mfrom: (1.1.8 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080726154345-c03m49twzxewdwjn
Tags: 0.24.5-2
* Fix puppetlast to work with 0.24.5
* Adjust logcheck to match against new log messages in 0.24.5
* Update standards version to 3.8.0 (no changes)
* Update changelog to reduce length of line to make lintian happy

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
require 'puppet/provider/package'
29
29
 
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
32
 
    
33
 
Author: Jeff McCune <jeff@northstarlabs.net>
34
 
 
35
 
Please direct questions about this provider to the puppet-users mailing list.
36
 
 
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.
40
 
 
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::
45
 
 
46
 
    package { Foobar.pkg.dmg: ensure => installed, provider => pkgdmg }
47
 
 
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
54
 
 
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
60
 
name, like so::
61
 
 
62
 
    Firefox-2.0.0.3-1.pkg.dmg
63
 
 
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.
66
 
 
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.
72
 
 
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.
78
 
 
79
 
If this is a problem for you, please patch the code, or bug Jeff to fix this.
80
 
 
81
 
Example usage::
82
 
 
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',
86
 
    }
87
 
 
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."
91
32
  
92
33
    confine :exists => "/Library/Receipts"
93
34
    commands :installer => "/usr/sbin/installer"