Application Packaging Developer's Guide

Adding Functionality to a prototype File

Besides defining every package object in the prototype file, you can also do the following:

See the following sections for information on making these changes.

Defining Additional Objects to Be Created at Install Time

You can use the prototype file to define objects that are not actually delivered on the installation medium. During installation, using the pkgadd command, these objects are created with the required file types, if they do not already exist at the time of installation.

To specify that an object be created on the target system, add an entry for it in the prototype file with the appropriate file type.

For example, if you want a directory created on the target system, but do not want to deliver it on the installation medium, add the following entry for the directory in the prototype file:


d none /directory 0644 root other

If you want to create an empty file on the target system, an entry for the file in the prototype file might look like the following:


f none filename=/dev/null 0644 bin bin

The only objects that must be delivered on the installation medium are regular files and edit scripts (file types e, v, f) and the directories required to contain them. Any additional objects are created without reference to the delivered objects, directories, named pipes, devices, hard links, and symbolic links.

Creating Links at Install Time

To create links during package installation, define the following in the prototype file entry for the linked object:

Relative links would be specified in this manner whether the package is installed as absolute or relocatable.

Distributing Packages Over Multiple Volumes

When you build your package with the pkgmk command, the command performs the calculations and actions necessary to organize a multiple volume package. A multiple volume package is called a segmented package.

However, you can use the optional part field in the prototype file to define which part you want an object to be located. A number in this field overrides the pkgmk command and forces the placement of the component into the part given in the field. Note that a one-to-one correspondence exists between parts and volumes for removable media formatted as file systems. If the volumes are preassigned by the developer, the pkgmk command issues an error if there is insufficient space on any volume.

Nesting prototype Files

You can create multiple prototype files and then include them by using the !include command in the prototype file. You might want to nest files for easier maintenance.

In the following example there are three prototype files. The main file (prototype) is being edited. The other two files (proto2 and proto3) are being included.


!include /source-dir/proto2
!include /source-dir/proto3

Setting Default Values for the mode, owner, and group Fields

To set default values for the mode, owner, and group fields for specific package objects, you can insert the !default command into the prototype file. For example:


!default 0644 root other

Note –

The !default command's range starts from where it is inserted and extends to the end of the file. The command's range does not span to included files.


However, for directories (file type d) and editable files (file type e) that you know exist on target systems (like /usr or /etc/vfstab), make sure that the mode, owner, and group fields in the prototype file are set to question marks (?). That way you will not destroy existing settings that a site administrator may have modified.

Providing a Search Path for the pkgmk Command

If the source location for package objects is different than their destination location, and you do not want to use the path1=path2 format as described in A Brief Word on an Object's Source and Destination Locations, then you can use the !search command in the prototype file.

For example, if you created a directory, pkgfiles, in your home directory, and it contains all of your information files and installation scripts, you can specify that this directory be searched when the package is built with the pkgmk command.

The command in the prototype file would look like the following:


!search /home-dir/pkgfiles

Note –

Search requests do not span to included files. In addition, a search is limited to the specific directories listed and does not search recursively.


Setting Environment Variables

You can also add commands to the prototype file of the form !PARAM=value. Commands of this form define variables in the current environment. If you have multiple prototype files, the scope of this command is local to the prototype file where it is defined.

The variable PARAM can begin with either a lowercase letter or an uppercase letter. If the value of the PARAM variable is not known at build time, the pkgmk command aborts with an error. For more information on the difference between build variables and install variables, see Package Environment Variables.