Creating Packages


With the number of complex files in a package, creating a package can seem intimidating at first. The Apple utility PackageMaker simplifies the process by letting you create packages using a setup assistant, add components to a distribution project, or manually create a package or metapackage project.

Tip

Many of the following features are unique to very recent versions of PackageMaker, so be sure you're using the most recent distribution of the Xcode Developer Tools.


Package Setup Assistant uses a familiar interface for package creation. It is intended to allow for quick and easy package creation with intelligent defaults. If you need different custom settings, simply open the package or metapackage in PackageMaker.

To open Package Setup Assistant, select File > New and click Assist Me. The assistant will walk you through the packagecreation process in the following steps:

1.

WelcomePrompts for basic package information.

2.

ContentsPrompts for the items to install.

3.

Bundle IdentifiersDisplays what packages will be created, and prompts for bundle identifiers and versions.

4.

MetadataPrompts for package metadata. Not displayed when creating a distribution.

5.

ResourcesPrompts for resources (for example, License, ReadMe, and so on).

6.

Package CreationWill create all packages and bundle them in a metapackage or distribution if necessary.

Creating a Distribution Project

Distribution projects can be created for systems that run Mac OS X v10.4 and higher (as well as Mac OS X Server v10.4 and higher). Although a distribution project is similar to a metapackage, it provides more flexibility in customizing the Installer interface. This flexibility is provided by a distribution script, which is XML combined with JavaScript.

To create a minimal, functional distribution project, do the following:

1.

Create the packages to be bundled.

2.

Using PackageMaker, give the distribution a title in the Installer Interface pane.

3.

Create choices for the items you want to install. Multiple packages can be attached to a single choice.

4.

Add the packages to the appropriate choices.

5.

Make sure the information for each package is correct.

6.

Build the distribution by choosing Project > Build.

After the distribution is built, you have the option of verifying the build while still within PackageMaker.

The following figure shows a distribution project window with various authentication and postinstall actions already selected.

Determining Package File Structure

The first step in manually creating a package project with PackageMaker is to create a folder hierarchy containing the files to be installed. This arrangement should represent the folder hierarchy of the system that will receive the installed files.

Begin by creating a folder that represents the root folder of where your files will be installed, as shown in the following figure. In most cases, your destination root folder will correspond to the root folder (/) of the target file system, but this may not always be the case. If, for example, you were creating a package just to install fonts, the root folder could represent /Library/Fonts. The folder structure for the installer is incredibly important. Folders that do not exist will be created, while folders that do exist can have the existing items replaced by the ones in the package.

Once you have the destination root folder, you populate it with files that you want installed by your package. The files are placed within a folder structure that matches where they will be placed on the target computer, relative to the destination root. Any folders that are in the destination root layout but are not on the target computer will be created automatically when the package is installed. Only use copies of the files with which you want to populate the folder hierarchy, because PackageMaker will alter the files during the packagecreation process.

Note

Use caution when naming the folders used in your folder structure. A typo here will create a new folder with the incorrect name, resulting in an installation that may not behave correctly, but also is often very difficult to diagnose later.


Note

Take note of folders that are symbolic links or aliases to other folders. Your folder structure should reflect the actual locations of the files, not use paths that include aliases. For example, files that are found in /etc/ actually live in /private/etc/.


Creating a Package Manually in PackageMaker

After you have created the folder hierarchy containing the files to be installed and included the resources, run the PackageMaker utility to convert the folder hierarchy into a package, using the Single Package Project option.

The PackageMaker window has five panes:

  • Installer Interface Allows you to add description information to the package. The Title field allows you to set the title for the Installer window. The title and description will be displayed to the user if the package is delivered as part of a metapackage.

    In Mac OS X v10.4, this pane also includes a button to open the Installer Interface Editor, which lets you drag and drop to change or add new text files and background image resources. Some users may find using the Install Interface Editor more convenient than placing the files in a resources folder.

  • Contents Allows the package builder to point to a folder containing the files to be added to the package. This path is the location of the files that will be stored inside the package. Click File Permissions to examine and change the permissions of the files that will be stored in your package.

Note

As you're creating your source folder hierarchy, most files will take your user name as their new owner. Be sure to click File Permissions and change the ownership back to root for most files. Otherwise, a normal user account will become the owner of the new files on the target computer. The File Permissions window contains a button to apply recommended permissions to all of the files. Although these permissions are usually sufficient, you'll want to examine the new permissions assigned to each file before continuing.


The Contents pane also allows you to add file filters and locator definitions (used to locate and identify previously installed software). Generally you will want to compress the archive,so your resulting package will be smaller. In most cases, you'll want to remove the .DS_Store files, but do not discard the resource forks. Including .DS_Store files or discarding resource forks can lead to problems with the appearance and operation of your installed files on the target computer.

  • Configuration Allows the package builder to configure the installation of the package contents. More details about this pane are included in the next section, "Setting Configuration Options."

  • Scripts Allows the package builder to point to a folder to include any necessary resources to the package, including scripts, tools, and documents such as license or welcome text files.

  • Package Version Allows the package builder to set version and display information. This includes a unique identifier for the package. Since this must be unique, consider using your domain name in reverse dot notation, also known as a Java-style package name. For example, for a package called MyGreatSoftware at Apple, use com.apple.mygreatsoftware as the identifier.

After you fill in the required information in PackageMaker, choose File > Save to save the configuration, and then choose Project > Build to create the package.

Note

A symbolic link to the command line version of PackageMaker also exists in /Developer/Tools. It is primarily useful if you want to automate the creation of a package or to create a snapshot, which creates a package based on changes to a specific directory. You can find more information by navigating to the /Developer/Tools directory and typing man packagemaker.


More Info

The Help > Online Documentation menu option in PackageMaker provides many details about each of the options in each pane.


Setting Configuration Options

The Configuration pane lists the options on the package. You can specify whether a restart and/or authorization is required. Also, you can set flags that affect the installation.

Here are the various options available in the Configuration pane:

  • Default Location The location of the root of the folder structure on the target computer. Note that if you are installing files into multiple folders, this must be the highest enclosing folder. For example, if you are installing files in /private/etc, /Applications, and /Library, you must specify the default location as /.

  • Authentication Specify one of the following options:

    • None User is not prompted for an admin password, and new files and folders will be owned by the user running Installer.

    • Admin If the user is signed on as a normal user, the user is prompted for an admin user name and password. Files and folders will have the ownership specified in the package, except when root is specified.

    • Root All users are prompted for an administrator user name and password. Files and folders will have the ownership specified in the package under all circumstances.

  • Post-Install Action Specify one of the following options:

    • None Installer can be closed after installation.

    • Recommended Restart User will be prompted to restart after installation but will have the option to quit without restarting.

    • Required Restart User will be prompted to restart after installation and won't be able to quit Installer without restarting.

    • Shutdown Required User will be prompted to shut down after installation and won't be able to quit Installer without restarting.

    Tip

    Unless it is absolutely necessary, don't force users to restart their machines.


  • Flags Select any of the following options:

    • Relocatable Allows the user to select where to install the software. Only use this option if the files being installed can be moved from their intended location and if all the files go into one location.

    • Root Volume Only Installer will allow installation onto the volume from which the system is running. Use this option sparingly, as it will prohibit the installation of this package with NetInstall.

    • Follow Symbolic Links If the path to an item to be installed contains a symbolic link and this option is selected, the path will be followed with the link. Otherwise, Installer will replace the symbolic link with a folder. In general, this option should be selected unless you know that you want Installer to replace any symbolic links with folders.

    • Overwrite Directory Permissions Selecting this option will direct Installer to change the permissions on existing folders to match those specified in the package. Use this option with caution, as it can cause unexpected system behavior if permissions are set incorrectly on system folders. Note that this option doesn't address ownership, only permissions.

    • Allow Revert To Previous Version Allows Installer to revert to an earlier version of the package.

    • Update Installed Languages Only Only languages that are currently installed will be updated.

Taking Advantage of Third-Party Utilities

Numerous third-party utilities exist to make package creation easier. There are utilities that cover every aspect of package creation.

logGen

logGen is a command-line utility that you can easily use to display files that were modified on your system. For example, you can compare file checksum values before and after an install so that you'll know what files need to be included in your package. More information is available at the LSA Mac OS X Software site (www.lsa.umich.edu/lsait/admin/mac/software/index.asp.

Iceberg and Composer

These applications provide alternatives to Apple's PackageMaker. Although they simplify many tasks of package creation, you'll want to carefully evaluate which of the three applications is the best fit for your project. Composer, from JAMF Software, can be found at www.jamfsoftware.com/products/composer, and Iceberg is available from White Box at http://s.sudre.free.fr/Software/Iceberg.html. The Iceberg application looks similar to PackageMaker and allows for many of the same options, plus a few more.

Pacifist

Pacifist, from CharlesSoft (www.charlessoft.com), provides a friendly graphical package inspector. This handy tool provides a quick Finderlike view of the files contained in the payload of a package. That's useful when building packages because it provides a quick way to visually inspect the results of your package building, but it can also be used to extract individual files from a package without installing the entire package. The following figure shows a package and all its contents in a Pacifist window displayed in a Finderlike interface.




Apple Training Series(c) Mac OS X v10. 4 System Administration Reference
Apple Training Series: Mac OS X v10.4 System Administration Reference, Volume 2
ISBN: 0321423151
EAN: 2147483647
Year: 2006
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net