Publishers of technology books, eBooks, and videos for creative people

Home > Articles

This chapter is from the book

Looking Inside a Package

A package is made up of a collection of files that tell Installer what to install, how to install it, and how to verify that it was installed. These items reside in the Contents folder inside the package. To view the contents of a package, Control-click the package and choose Show Package Contents from the shortcut menu. This command opens a new Finder window, in which the package contents are displayed. Or, simply cd into the package from the Terminal.

The Contents folder includes a bill of materials (.bom) file that describes the contents of the package. The BOM file contains a list of every file installed by the package, along with the ownership and permissions of each file. You can examine the contents of a BOM file by typing

lsbom Archive.bom

from inside the Contents folder. This folder also contains an information property list file (.plist) that contains the information entered in the package definition file when it was created. This file contains such details about the package as the authorization required to install and whether the package requires the computer to be rebooted after installation.

You can view this file in any text editor or with the Property List Editor application included with the Xcode Developer Tools. The archive file contains the set of files to be installed (payload) and is usually compressed (in gzip format) to save space. The size-calculation file is a text file that contains the compressed and uncompressed sizes of the package’s payload. Installer uses this to calculate the space required to install the payload.

The Resources folder contains files that customize the behavior and look of Installer during the installation process. Resource files include environment test scripts and installation scripts (described later in this lesson), in addition to text files and a background image. The text files may include an introduction file, a read-me file, and a license file. When your resource folder contains these text files, the program will display the text contained within them in the Installer interface. The files should be in RTF format with the .rtf suffix, so the introduction file will be named Welcome.rtf, the read-me file will be ReadMe.rtf, and the license file will be License.rtf. Installer has the ability to show many types of files, including raw text (.txt), HTML (.html), and RTF directories (.rtfd), which are RTF files with embedded images. The background image, which must be named background.tif, will display in the background of each screen in Installer. The background image can be of any of the following file types: .jpg, .tif, .tiff, .gif, .pict, .eps, and .pdf.

To use localized versions of the resources, create folders with the name languagename.lproj, and put the resources for that language in that folder. Note that the scripts cannot be localized, but any of the information presented to the user can be localized.

You enter localized versions of messages in files with the .strings extension. Each .strings file contains messages localized for one language. You then place these files in the appropriate localized-resource directories (which have the .lproj extension). You don’t need to create all of the resources. If any resources are missing, either they will be skipped or a default will be presented. For example, if Welcome.rtf is missing, a default pane asks the user to proceed to the installation. If License.rtf is missing, no license pane will appear.

Creating Distribution Scripts

In order to make sure that your software is installed correctly, PackageMaker allows scripts to customize the installation behavior. JavaScript can be used to create a distribution script to customize the installation experience. Specific shell scripts can be used in a package to carry out commands before and after the package is installed.

Installer distribution scripts are new in Mac OS X v10.4 and can help verify various hardware requirements prior to installing packaged software. This feature allows you to define the user experience within Installer using a single configuration file. You store this file in either a .pkg file or a .mpkg file, or save it as a .dist file. You can also take a metapackage and convert it to a distribution script. Use distribution scripts to do the following:

  • Specify the relationship between packages and the custom selection user interface, allowing creation of complex dependencies
  • Exercise full control over the user interface
  • Base the behavior of the user interface on the capabilities and configuration of the target computer

You can now consolidate many of the flags and functions configured by PackageMaker and the included shell scripts (such as InstallationCheck and VolumeCheck) into a single distribution script. The entire range of flags and standard package scripts, plus new features of Installer, are configured using JavaScript within that one file.

For more information on distribution scripts, install the Xcode tools for Mac OS X v10.4 and open /Developer/ADC Reference Library/releasenotes/DeveloperTools/Installer.html.

Running Package Scripts

Scripts are an optional element of an installation package. You add scripts when you need to test certain conditions before installation or when you need to perform special tasks as the installation takes place. (You’ll learn to add a script to an installation later in this lesson.)

Scripts can be run before and after the package’s contents are installed. You can define two types of scripts: environment-test scripts and installation scripts. Environment-test scripts can determine whether the hardware and software of the target computer meet the package’s requirements. Environment-test scripts include the following:

  • InstallationCheck— Installer runs this shell script early in the installation process to determine whether the installation should proceed. If the installation cannot proceed, Installer displays a localizable message to the user. Supply this file to check for criteria such as minimum hardware requirements.

  • VolumeCheck— Installer runs this script once for each mounted volume to determine whether a particular volume can receive the package’s payload. If the installation cannot be done on a volume, Installer communicates this fact to the user, again using a localizable message. Supply this file to check for volume criteria and restrict the volumes on which a user can install. This script is usually used to check for software dependencies on each volume, such as the operating system installed on that volume.

Installation scripts perform tasks you deem necessary to prepare for installation and to clean up after an installation is completed. Use these scripts to create needed files, add configuration options to existing files, start and stop services, and verify that setup is done correctly. These are the default installation scripts:

  • preflight— Runs before all other scripts, and before the installation or upgrade takes place

  • preinstall— Runs after the preflight script for new installation

  • preupgrade— Runs after the preflight script when Installer determines that the installation is an upgrade

  • postinstall— Runs after the initial installation

  • postupgrade— Runs after an upgrade installation

  • postflight— Runs after all other scripts

The following list shows the order in which the scripts are executed and the point at which the actual installation takes place:

  1. InstallationCheck—Can cancel the installation.
  2. VolumeCheck—Can cancel the installation.
  3. preflight.
  4. preinstall or preupgrade.
  5. Installer extracts and installs the package’s contents (payload).
  6. postinstall or postupgrade.
  7. postflight.

When a package script is run, four arguments are automatically passed to it that contain information useful to the script:

  • $1— The full path to the package being installed; for example: /Volumes/Projects/Testing/PackageName.pkg

  • $2— The full path to the installation destination; for example: /Applications

  • $3— The mountpoint of the destination volume; for example: / or /Volumes/External_Drive

  • $4— The root directory for the current System directory: /

Environment–test scripts and installation scripts can refer to other scripts, but the referred scripts must be included in the package’s resources folder. You can see numerous example scripts by examining other packages. The scripts used by packages that have already been installed on your system can be found in /Library/Receipts/PackageName.pkg/Contents/Resources.

Using Payload-Free Packages

A payload-free package is a package that contains no files to install, so the Installer application uses scripts to automate any process. Payload-free packages are created using the same methods as with regular packages, but with no installed files. Payload-free packages contain only scripts that can automate tasks, as shown in the following figure.

You can populate the resources folder with the same scripts as described in the previous section. This is particularly useful if you need users to run Unix commands on their computers, even if they aren’t comfortable working in Terminal. Simply include the command in a postflight script in a payload–free package and ask the user to install the package by double–clicking it.

One way to use this method would be to create a Network Install image from a payload–free package containing a script that runs Apple Software Restore (ASR) over multicast to restore the local volume. See Lesson 2, “Creating and Using Disk Images,” and Lesson 4, “Delivering Images and Packages,” for information on setting up Network Install images and ASR multicast.

Using Receipts

During installation, Installer creates a package file called a receipt that contains the package’s resources and a list of the files, permissions on the file with the file size, and a checksum. Note that the receipt doesn’t actually contain the files that are installed (the payload), so receipt files are small. For a list of the files that were installed by the package, enter the following command on the command line:

lsbom /Library/Receipts/PackageName.pkg/Contents/Archive.bom

When Installer is installing a package, it uses the existence of a receipt to determine whether to install or upgrade. If a receipt exists, and version information exists in the software that is being installed, Installer can skip some files that don’t need to be upgraded. Installer will also execute the preupgrade and postupgrade scripts instead of the preinstall and postinstall scripts that are run during an install.

As the following figure shows, receipt packages do not contain the actual files that were installed, but they contain the information about those files. Double–clicking a receipt will produce the error message shown below.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020