Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mac: How to add a License.txt to a pkg built with productbuild using --component option?

We currently build our mac installer as a pkg file using productbuild --component (as per the following post: Mac app store productbuild).

This works wonderfully, but I also wish to add a license file to this installer.

With packagemaker, you can specify the option --resources [path_to_resources_file]. If you put a License.txt in the specified resources folder, the installer magically includes a license step.

Whilst productbuild's man page describes a --resources option too, in practice this does not appear to work with the --component option. It just seems to ignore the option altogether.

According to the productbuild man page, the --component option apparently only takes a product definition plist (I had a look through the plist options and none seemed to apply to a license file), a component, an optional install path and an output path. Although the --sign option also works.

Does anyone know whether it is possible (and if so, how) to include a license file for the installer when using productbuild --component?

Thanks in advance.

Iain

like image 402
user427182 Avatar asked Aug 14 '12 13:08

user427182


People also ask

How do I make a pkg file on a Mac?

Creating Software Package with Single FileNavigate to Software Deployment -> Add Packages -> Mac. Specify a name for the Package and provide the details of the package for your personal reference. Click Installation tab.

Does Mac support pkg files?

MacOS applications can be distributed and installed in many different ways. One way developers distribute macOS applications is by packaging them in PKG files, which macOS recognizes as application installers. Each PKG file includes all the files needed to install the application it contains.

Where do I put pkg files on Mac?

Drag the application to the Applications folder. Most . pkg files will do all the work for you, but sometimes with . dmg files, you will need to drag the app to the applications folder.


1 Answers

In your distribution file that you pass as a parameter to productbuild, include a license element, like this:

<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="1">
    <title>My Awesome App</title>
    <welcome file="welcome.html" />
    <readme file="readme.html" />
    <license file="license.html" />
    <conclusion file="conclusion.html" />

    <options customize="never" />
    <choices-outline>
        <line choice="install"/>
    </choices-outline>
    <choice id="install" visible="true" title="Install" description="Installation description goes here">
        <pkg-ref id="com.prosc.RemoteExecution.install.pkg">#installer.pkg</pkg-ref>
    </choice>
</installer-gui-script>

These files need to be present in whatever directory you specify in the --resources parameter that you pass to productbuild, like this:

productbuild --distribution distribution.xml --resources building/ "Mac Installer.pkg"
like image 120
Jesse Barnum Avatar answered Oct 19 '22 10:10

Jesse Barnum