Shane Kirk
Shane Kirk

Reputation: 301

Custom UI for OSX Packages

I have an OSX flat package being built using a combination of pkgbuild and packagebuild. I need to add a new page in the UI for gathering a small amount of data from the user - a key. And I'm not entirely sure how to accomplish this.

I've read older articles/threads that discuss the use of Cocoa-based installer plugins, link to sample code that's long since disappeared, and offer up pointers on using PackageMaker to accomplish this, a tool which has fallen out of favor. I've yet to find any discussion on how to bundle plugins using nothing more than pkgbuild and/or packagebuild.

I can build an installer plugin using Xcode. That seems to work ok. But I'm not entirely sure how to get it into the package after it's built. Does anyone know how this might be accomplished?

It's probably worth noting that I need an approach that's scriptable (for CI).

Upvotes: 3

Views: 1469

Answers (1)

Shane Kirk
Shane Kirk

Reputation: 301

I figured out a solution. If anyone knows of a better approach for this, let me know. Here's how I did it...

First expand the package using pkgutil like so...

pkgutil --expand mypackage.pkg mypackage

This will explode the package contents into the folder "mypackage". Inside of this folder, create a new folder called "Plugins". Inside of this, you'll place both the plugin bundle as well as the plugin's InstallerSections.plist file. The InstallerSections.plist file is important. Without it, the plugin won't appear.

Once you've updated the directory structure, you can flatten it back to a flat package like so...

pkgutil --flatten mypackage mypackage.pkg

That's what worked for me.

Upvotes: 6

Related Questions