Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
  Previous   Contents   Next 
   
 
Chapter 3

Enhancing the Functionality of a Package

This chapter describes how to create optional information files and installation scripts for a package. While Chapter 2, Building a Package discussed the minimum requirements for making a package, this chapter discusses additional functionality that you can build into a package, based on the criteria you considered when planning how to design your package (for more information, see "Things to Think About Before Building a Package").

This is a list of the overview information in this chapter.

Creating Information Files and Installation Scripts Task Map

The table below lists and describes the optional features you can build into a package.

Table 3-1 Creating Information Files and Installation Scripts Task Map

Task

Description

For Instructions, Go To ...

1. Create Information Files

Define Package Dependencies

A definition of package dependencies allows you to specify whether your package is compatible with previous versions, dependent on other packages, or whether other packages are dependent on yours.

"How to Define Package Dependencies"

 

Provide a Copyright Message

A copyright file provides legal protection for your software application.

"How to Write a Copyright Message"
 

Create Additional Space on the Target System.

A space file sets aside blocks on the target system, which enables you to create files during installation that are not defined in the pkgmap file.

"How to Reserve Additional Space on a Target System"

2. Create Installation Scripts

Obtain Information From the Installer

A request script enables you to obtain information from the person installing your package.

"How to Write a request Script"

 

Gather File System Data Needed For Installation

A checkinstall script enables you to perform an analysis of the target system and set up the correct environment for, or cleanly halt, the installation.

"How to Gather File System Data"

 

Write Procedure Scripts

Enables you to provide customized installation instructions during specific phases of the installation or removal process.

"How to Write Procedure Scripts"

 

Write Class Action Scripts

Enables you to specify a set of instructions to be executed during package installation and removal on specific groups of package objects.

"How to Write Class Action Scripts"

Creating Information Files

This section discusses optional package information files. With these files you can define package dependencies, provide a copyright message, and reserve additional space on a target system.

Defining Package Dependencies

You need to determine whether your package has dependencies on other packages and if any other packages depend on yours. Package dependencies and incompatibilities can be defined with two of the optional package information files, compver and depend. Delivering a compver file lets you name previous versions of your package that are compatible with the one being installed. Delivering a depend file lets you define three types of dependencies associated with your package. These dependency types are:

  • A prerequisite package - meaning your package depends on the existence of another package

  • A reverse dependency - meaning another package depends on the existence of your package


    Note - Use the reverse dependency type only when a package that cannot deliver a depend file relies on your package.


  • An incompatible package - meaning your package is incompatible with the named package

The depend file resolves only very basic dependencies. If your package depends upon a specific file or its contents or behavior, the depend file does not supply adequate precision. In this case, a request script or the checkinstall script should be used for detailed dependency checking. The checkinstall script is also the only script capable of cleanly halting the package installation process.


Note - Be certain that your depend and compver files have entries in the prototype file. The file type should be i (for package information file).


Refer to depend(4) and compver(4) for more information.

How to Define Package Dependencies

  1. Make the directory containing your information files the current working directory.

  2. If previous versions of your package exist and you need to specify that your new package is compatible with them, create a file named compver with your favorite text editor.

    List the versions with which your package is compatible, using this format:

    string string . . .

    string

    Is identical to the value assigned to the VERSION parameter in the pkginfo file, for each compatible package.

  3. Save your changes and quit the editor.

  4. If your package depends on the existence of other packages, other packages depend on the existence of your package, or your package is incompatible with another package, create a file named depend with your favorite text editor.

    Add an entry for each dependency, using this format:

    type pkg-abbrev pkg-name
        (arch) version
        (arch) version . . .

    type

    Defines the dependency type. Must be one of the following characters: P (prerequisite package), I (incompatible package), or R (reverse dependency).

    pkg-abbrev

    Specifies the package abbreviation, such as SUNWcadap.

    pkg-name

    Specifies the full package name, such as Chip designers need CAD application software to design abc chips. Runs only on xyz hardware and is installed in the usr partition.

    (arch)

    Optional. Specifies the type of hardware on which the package runs. For example, sparc or x86. If you specify an architecture, you must use the parentheses as delimiters.

    version

    Optional. Specifies the value assigned to the VERSION parameter in the pkginfo file.

    For more information, see depend(4).

  5. Save your changes and quit the editor.

  6. Complete one of the following tasks:

  7. Build your package.

    See "How to Build a Package", if needed.

Where to Go Next

After you build the package, install it to confirm that it installs correctly and verify its integrity. Chapter 4, Verifying and Transferring a Package explains how to do this and provides step-by-step instructions on how to transfer your verified package to a distribution medium.

Example--compver File

In this example, there are four versions of a package: 1.0, 1.1, 2.0, and the new package, 3.0, which is compatible with all the three previous versions. The compver file for the newest version might look like:

release 3.0
release 2.0
version 1.1
1.0

Note - The entries do not have to be in sequential order. However, they should exactly match the definition of the VERSION parameter in each package's pkginfo file. In this example, the package designers used different formats in the first three versions.


Example--depend File

This example assumes that the sample package, SUNWcadap, requires that the SUNWcsr and SUNWcsu packages already be installed on a target system. The depend file for SUNWcadap looks like:

P SUNWcsr Core Solaris, (Root)
P SUNWcsu Core Solaris, (Usr)
 
 
 
  Previous   Contents   Next