Payload-Free Package Creator.app
I do a lot of work with payload-free packages and I’ve looked for a while for a tool that would let me easily create them from existing scripts. While I have a process for creating them as needed with pkgbuild, this approach still requires some setup work.
After thinking about it and taking a look at various approaches, I’ve developed Payload-Free Package Creator.app, an Automator application that will allow the selection of an existing script and create a payload-free package that runs the selected script. For more details, see below the jump.
Using Payload-Free Package Creator.app
2. Once downloaded and unzipped, double-click on the Payload-Free Package Creator application.
3. You’ll be prompted to select the script that you want to create a payload-free package from.
4. Once you’ve selected the script, you’ll be prompted to name the payload-free package. By default, the name filled in will be Payload-Free Installer Package.
This name can be changed as desired.
5. Once you’ve entered a name for the installer package, you’ll be prompted for a package identifier. By default, the name filled in will be com.github.payload_free
This name should be changed to be something unique.
6. Once the package name and package identifier have been set, Payload-Free Package Creator.app will prompt for an administrator’s username and password.
7. Once the admin username and password are provided, Payload-Free Package Creator.app will create the payload-free package and prompt you when it’s finished.
8. Click OK at the prompt and a new Finder window will open to display the newly-created payload-free package.
9. Payload-Free Package Creator.app will automatically exit once finished.
How Payload-Free Package Creator.app works
Payload-Free Package Creator.app is an Automator application that uses AppleScript, shell scripting and pkgbuild behind the scenes to create payload-free packages. When a script is selected, the following process takes place:
1. The script is copied to /tmp and the file is renamed to postinstall, to match the name that pkgbuild is expecting for a post-installation script.
2. After the package name and package identifier are chosen, /tmp is checked to make sure that there is not an existing directory that is named the same as the chosen name. If a matching directory is found, it is removed.
3. A new directory is created in /tmp that matches the chosen name of the package.
4. Next, a scripts directory is created inside of /tmp/package_name_here.
5. The postinstall script is moved to /tmp/package_name_here/scripts.
6. The payload-free package is built by pkgbuild using the postinstall script stored in /tmp/package_name_here/scripts.
7. The finished payload-free package is stored in /tmp/package_name_here and the user is prompted that the process is finished.
8. Once the user is notified and clicks OK, a new Finder window opens for /tmp/package_name_here.
The total workflow looks like this:
The AppleScript used to create the payload-free package as part of the Automator work is below:
All Payload-Free Package Creator components and scripts are available at my GitHub repo:
The Automator workflow files and the AppleScript are also available via the link above if you want to build a customized Payload-Free Package Creator for your own environment.