In today's article, we will look at the new flat package format. First, we learn how this format compares with earlier bundle-style formats. Then we examine the structure of a typical flat package. Finally, we look at three useful tools with which to manage the package.
- An XML file containing the default settings for the entire package. To view its contents, use the Property List Editor tool. You can also view the file with a text editor, if you are familiar with XML.
Flat Package Editor Download Mac
Finally, assume you selected 10.5 as your minimum OS target. (In Snow Leopard's PackageMaker v3.04, "10.5" remains the highest target OS). Now, when you choose Build from the Project menu, PackageMaker builds the package as a flat file, not as a bundle. As a result, you can no longer view the package's contents from the Finder using the Show Package Contents menu.
The flat package uses a structure different from the previous three formats (Figure 5). First, it does away with the Contents directory, and certain files like Info.plist and PkgInfo. Second, it keeps its main items like payloads and resources at the root level. Third, it renames the distribution.dist file as simply Distribution. It still, however, uses lproj bundles to store any localized files.
The flat package also uses a more compact format for its payloads. Each payload package now has three files, instead of the bevy of items from older formats (see Figure 4). The Bom file takes the place of Archive.bom. The Payload file replaces Archive.pax.gz, using gzipped cpio as an archive format. The PackageInfo file, on the other hand, is an XML rendition of PkgInfo.
Finally, the flat package stores its install scripts differently. A pre- or post-install action, for instance, becomes an action payload (Figure 6). Its payload name consists of the main package name and the action type.
Since the flat package is a single file, it is much easier to distribute over the network. Bundle packages, on the other hand, needs to be "repackaged" in another form like a disk image or a zip archive. But the flat package is supported only on OS X 10.5 or newer. It harder to customize after being built, and it does not support installer plug-ins.
PackageMaker 3.0 comes with three tools that you can use to work with flat packages. One tool, the Flat Package Editor, lets you view the package's contents, as well as make some simple changes. Obviously, you cannot use this tool to open one of the three bundle packages. Doing so will only result in an error.
There are two ways to start the editor. The first way is to choose Launch Flat Package Editor... from the Edit menu of PackageMaker. After the editor launches, choose Open from its File menu, and use the Open File dialog to select the flat package. Click the Open button to open the selected package.
The second way is to select the flat package with a Control-click. Then choose Flat Package Editor from the Open With contextual sub-menu. Both approaches will display the package contents as a hierarchical list (Figure 8). Bundles and directories inside the package appear with a triangle widget next to their icons. Clicking the triangle displays the contents of that bundle or directory.
Assume you want to add a new item to the flat package. To add a file, drag the file from the Finder to the editor window. Once the editor highlights the desired position in the package, drop the file at that position (Figure 9). The editor then copies the file into the package. If the position happens to be in a bundle or directory, the editor reveals its contents prior to the drop.
To add a new directory to the package, click the New Folder button from the editor toolbar. The editor adds the directory at the end of the list (Figure 11, left). You can then rename the new directory by double-clicking its name.
To enclose a package item inside a new directory, first select the item from the window. Then click the New Folder button from the toolbar. This time, the editor creates the directory at the same position as the item. It then moves the item into said directory (Figure 11, right). But the editor will not enclose certain files (such as Distribution) with a new directory. Nor will it do the same for payload bundles or the Resources directory. So, if you do select any of these items, the editor will simply refuse to do the New Folder action.
Now assume you want to remove an item from the flat package. First, select the item from the editor window. Then click the Delete button on the window toolbar (Figure 12). If the selected item is a file, the editor marks it for deletion and then removes its icon from the window. If the item is a bundle or directory, the editor marks it and its contents for deletion. In either case, the item is still present in the flat package. To complete the removal, choose Save from the File menu. To cancel the removal, close the editor window; then click the Don't Save button from the ensuing dialog.
We can also edit the package items, although in a limited and restricted fashion. To start, select the item in question; then click the Info button from the editor toolbar. The editor responds by displaying an Info panel for the selected item (Figure 13).
The edit feature has a couple of quirks. First, selecting a different package item does not update the Info panel. Instead, the panel continues to display information for the last selected item. You can, however, click the Info button and get another Info panel for the new selection. Second, changing the compression scheme sometimes does not affect the item's size. This may mean a number of things: the item is incompressible, the editor has a display bug, or the compression simply did not work. Whatever the cause is unconfirmed at this time.
Finally, you can use the editor to digitally sign a flat package. This feature helps ensure and protect a package's authenticity for your users. You can learn more about digital signatures, their benefits, and issues in MacTech's series on PKI (June 2009, through September 2009), or from the following Wikipaedia entry:
Next, switch to the Flat Package Editor and click the lock icon on the upper-right corner of the toolbar. The editor responds with a sheet dialog (Figure 15). To see more details of the certificate, select it and click the Show Certificate button. To use the certificate, click the Choose button. Then choose Save from the File menu to sign the package with that certificate. If the signing is successful, the editor will display a grey lock icon.
The pkgutil tool is another utiity that we can use when working with a flat package. Unlike the Flat Package Editor, pkgutil is a command-line tool. This means we can only use the tool within a Terminal window session or as part of a shell script.
Here, the command flag sets the desired operation. The package argument is the path to the flat package, the directory argument the path to a working directory. There are but a handful of commands that apply a flat package. The rest of the commands only apply to the new receipts database, which is a topic for another time.
In the above example, pkgutil uses the items stored in the foobar directory to create the new flat package named barfoo.pkg. Make sure, of course, to maintain the same directory structure as shown in Figure 5. Otherwise, the newly created flat package will be unusable.
Yet, another tool we can use with flat packages is the xar tool. This tool creates the archive format used by a flat package. The xar tool is a product of the defunct OpenDarwin project. It is a command-line tool, like pkgutil. But while pkgutil works on flat packages and the new receipts database, xar works exclusively on flat packages.
Next, assume you have your payloads, support files and bundles in the directory Foo. To store these items into a flat-package, first type cd Foo at the Terminal prompt. Then use the xar tool with a -c command as follows.
Here, the xar tool creates the package Barfoo.pkg using the items in the Foo directory. But creating a flat package with the xar tool presents some issues. First, the payloads must use the bundle format shown in Figure 5. This is difficult to do as we do not know the format of the Payload file.
The flat package has several benefits not found in the older bundle-type packages. It is easier to distribute online due to being a single file. Its structure is simpler and more compact than either a meta- or distribution package. Also, it supports digital signatures.
Yet the flat package is harder to customize and fix once built. Its support tools are either unpolished or limited in features. It does not support plug-ins to enhance the install session. Also, it can only deliver its payloads to 10.5 or 10.6 targets.
So, if you still support 10.4 and older targets, best stay with either a meta- or distribution package. But if you plan to support only targets that are 10.5 or above, then give the flat package a try.
Edit: I have also tried to use pkgutil to expand, edit Distribution, and reflatten a flat package. This gets the icons and readme in the installer, but the installer is then unable to unpack the payload. Same if I reflatten with Flat Package Editor. I have also tried to create an expanded package without PackageMaker (which works, except on 10.8), but when I try to flatten that with pkgutil the result is a corrupted package again.
You can package archived versions of software as well. Select the Show archived versions check box to display the list of supported previous versions, if any. If the product or update that you selected has already been downloaded to your machine, a Down Arrow appears next to its name.
The Adobe Creative Cloud Packager downloads the products and updates that have not been downloaded already to your machine. It then builds the package. The progress is displayed on the Download Progress and the Build Progress screens.
This option will import an existing package and convert it into a package project. project_dir must not exist; it will be created. build-info will be in plist format, add the --json option to output in JSON format instead. (IE: munkipkg --json --import /path/to/flat.pkg /path/to/project_dir) Not all package formats are supported. 2ff7e9595c
Comments