Quantcast
Channel: rtrouton – Der Flounder
Viewing all articles
Browse latest Browse all 764

Payload-Free Package Creator.app

$
0
0

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.

Payload-Free Package Creator logo

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

1. If needed, download the Payload-Free_Package_Creator_Application.zip file from the application directory in my GitHub repo.

2. Once downloaded and unzipped, double-click on the Payload-Free Package Creator application.

Screen Shot 2014-03-07 at 5.35.57 PM

3. You’ll be prompted to select the script that you want to create a payload-free package from.

Screen Shot 2014-03-07 at 7.33.43 PM

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.

Screen Shot 2014-03-07 at 5.25.04 PM

This name can be changed as desired.

Screen Shot 2014-03-07 at 5.21.36 PM

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

Screen Shot 2014-03-07 at 5.21.48 PM

This name should be changed to be something unique.

Screen Shot 2014-03-07 at 5.22.04 PM

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.

Screen Shot 2014-03-07 at 5.22.17 PM

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.

Screen Shot 2014-03-07 at 5.22.25 PM

8. Click OK at the prompt and a new Finder window will open to display the newly-created payload-free package.

Screen Shot 2014-03-07 at 5.24.04 PM

Screen Shot 2014-03-07 at 5.24.16 PM

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:

Screen Shot 2014-03-07 at 4.32.02 PM

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:

https://github.com/rtrouton/Payload-Free-Package-Creator

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.



Viewing all articles
Browse latest Browse all 764

Trending Articles