OS X packages

timsutton edited this page Jan 7, 2013 · 1 revision

The 'osxpkg' type uses Apple's command-line 'pkgbuild' tool to build OS X 'flat' Installer packages. Stéphane Sudre has a great documentation page on what he's been able to document on the flat package format.

ERB templates are used to supply a PackageInfo template to pkgbuild using the --info option. This option is undocumented, but seems there for convenience. It's not the only way to customize a built PackageInfo file.

Requirements

  • running OS X
  • must have 'pkgbuild' in the user's PATH (on vanilla 10.7/10.8 systems, this is already the case – on 10.6, Xcode/Developer Tools version 4.2 must be installed, and you'd most likely need to have /Developer/usr/bin added to your PATH)

FPM feature support

  • input/output
  • pre/post-install scripts (no --remove support as OS X installer has no real uninstall functionality)
  • platform-specific package features:
    • post-install actions (--osxpkg-postinstall-action: logout, restart, shutdown)
    • ownership option (--osxpkg-ownership: passed to pkgbuild's --ownership option)
    • payload-free (--[no-]osxpkg-payload-free: scripts only, no files)
    • dont-obsolete (--osxpkg-dont-obsolete: files to ensure are persistent across future upgrades)

OS X package conventions

OS X packages don't carry the same architecture/dependencies/maintainer metadata that other *NIX packaging systems do, so much of this information is discarded if converting from rpm/deb/solaris.

OS X packages also tend to use a reverse-domain naming convention similar to Java, and this is known as an identifier. This is the only identifier for a package, there is no name.

For example, Apache on OS X uses the identifier org.apache.httpd. For this reason, the --osxpkg-identifier-prefix option should always be used to follow system conventions:

fpm -s dir -t osxpkg --osxpkg-identifier-prefix org.apache --name httpd --version 2.4.3 /opt/apache-staging

When an OS X package is used as input, the name derived will be the last dot-component of the identifier, httpd in this case.

TODO

  • signing options
  • support user-supplied PackageInfo template files for advanced customization
  • build on other platforms?
    • archive formats (.pkg using xar, Payload using gzipped cpio) shouldn't be a problem, but BOM must be generated
    • StackOverflow thread, lsbom sample code - mkbom would need to be written
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.