.pkg
file extensions.xar
archives (see the xar
man page).pkgutil--expand
, as in:an_output_dir
beforereconstituting the package with:tar
will unpack xar archives, and will automatically detect thatthe archive is in xar format with tarxfmy.pkg
, if you really want to dothe unpacking without pkgutil
.productbuild
man page for more detail.preinstall
and postinstall
scripts.preinstall
script if present. An exit code other than zero abortsthe installation.postinstall
script if present. An exit code other then zero givesan error message.scripts/preinstall
scripts/postinstall
/
with:scripts/postinstall
preinstall
, postinstall
scripts:scripts/preinstall
--root
flag to pkgbuild
. Thisanalyzes a given directory root-path
taking this directory to representthe root /
directory of the target system. The installer will copy eachdirectory at root-path
to the target system at the same relativefilesystem location.--component
flag topkgbuild
. Specify directories to copy, and give their output locationsseparately using the --install-location
flag.pkgbuild
will not know which component to get an identifier from.Distribution
specifies these options (see distributiondefinition file).productarchive
¶productarchive
has five modes of action:--content
flag for this one.--root
directory give the output install location on the target volume(see Destination root).--component
flag (seeExplicit component(s)) and / or;--package
flag.Distribution
file from component bundle(s) / packages(s)¶Distribution
XML file by analyzing one or morecomponents in the form of bundles or .pkg
files. Use the --synthesize
flag.Distribution
file:Distribution
file:Distribution
file¶Distribution
file, using the--distribution
flag. The Distribution
file refers to pre-existingcomponent .pkg
files. If these are not in the current directory, you cangive paths to find .pkg
files with the --package-path
flag.Distribution
file¶distro_check.xml
Distribution
Javascript with system.log
¶system.log()
can help.distro_debug.xml
-dumplog
flag to the installer to see the log.allow-external-scripts
option in theDistribution file XML:system.run()
function. The programs you call with system.run
either need to be on thesystem PATH that the installer uses, or provided in the installer, usually viathe --scripts
flag to productbuild
. Here’s an example of a commandalready on the path:distro_system_run.xml
distro_custom_run.xml
archive_scripts/my_test_cmd.sh
--scripts
flag:/tmp/my_sudo_envs.log
with the standard environment variablesavailable as root, so look for the difference:.pkg
file is. Here we can work out which volume the installeris installing to with the SUDO_COMMAND
variable, but this will only workfor command line installs - the installer GUI does not set this variable.<welcome../>
element)<readme../>
)<license../>
)<conclusion../>
)Resources/<language>.lproj
directory of theinstaller .pkg
, where <language>
is a language like “English”,“French” or “Spanish”, or shorthand for these such as “en”, “fr”, “es”. Youcan provide a Resources
directory with the --resources
flag toproductbuild
.my_resources/English.lproj/welcome.html
distro_welcome.xml
--resources
flag to add the resources directory:.rtf
files instead of HTML, but I heard arumor that productbuild
does not deal with these correctly. If you want touse rich text format files with productbuild
, you might have to do somepost-processing of your installer with – pkgutil--expandmy_archive.pkgout_dir
; (futz); pkgutil--flattenout_dirmy_archive.pkg
.