Application Packaging Developer's Guide

Format of the prototype File

Here is the format for each line in the prototype file:


partftypeclasspathmajorminormodeownergroup

part

Is an optional, numeric field that enables you to group package objects into parts. The default value is part 1. 

ftype

Is a one-character field that specifies the object's type. See The ftype Field.

class

Is the installation class to which the object belongs. See The class Field.

path

Is the absolute or relative path name indicating where the package object will reside on the target system. See The path Field.

major

Is the major device number for block or character special devices. 

minor

Is the minor device number for block or character special devices. 

mode

Is the octal mode of the object (for example, 0644). See The mode Field.

owner

Is the owner of the object (for example, bin or root). See The owner Field.

group

Is the group to which the object belongs (for example, bin or sys). See The group Field.

Usually, only the ftype, class, path, mode, owner, and group fields are defined. These fields are described in the following sections. See the prototype(4) man page for additional information on these fields.

The ftype Field

The ftype, or file type, field is a one-character field that specifies a package object's file type. Valid file types are described in the following table

Table 2–3 Valid File Types in the prototype File

File type field value 

File Type Description 

f

Standard executable file or data file 

e

File to be edited upon installation or removal (may be shared by several packages) 

v

Volatile file (whose contents are expected to change, such as a log file) 

d

Directory 

x

Exclusive directory accessible only by this package (may contain unregistered logs or database information) 

l

Linked file 

p

Named pipe 

c

Character special device 

b

Block special device 

i

Information file or installation script 

s

Symbolic link 

The class Field

The class field names the class to which an object belongs. Using classes is an optional package design feature. This feature is discussed in detail in Writing Class Action Scripts.

If you do not use classes, an object belongs to the none class. When you execute the pkgmk command to build your package, the command inserts the CLASSES=none parameter in the pkginfo file. Files with file type i must have a blank class field.

The path Field

The path field is used to define where the package object will reside on the target system. You may indicate the location with either an absolute path name (for example, /usr/bin/mail) or a relative path name (for example, bin/mail). Using an absolute path name means that the object's location on the target system is defined by the package and cannot be changed. Package objects with relative path names indicate that the object is relocatable.

A relocatable object does not need an absolute path location on the target system. Instead, the object's location is determined during the installation process.

All or some of a package's objects can be defined as relocatable. Before writing any installation scripts or creating the prototype file, decide if package objects will have fixed locations (such as start-up scripts in /etc) or be relocatable .

There are two kinds of relocatable objects, collectively relocatable and individually relocatable.

Collectively Relocatable Objects

Collectively relocatable objects are located relative to a common installation base called the base directory. A base directory is defined in the pkginfo file, using the BASEDIR parameter. For example, a relocatable object in the prototype file named tests/generic requires that the pkginfo file define the default BASEDIR parameter. For example:


BASEDIR=/opt

This example means that when the object is installed, it will be located in the /opt/tests/generic directory.


Note –

The /opt directory is the only directory to which software that is not part of the base Solaris software may be delivered.


Use collectively relocatable objects whenever possible. In general, the major part of a package can be relocatable with a few files (such as files in /etc or /var) specified as absolute. However, if a package contains many different relocations, consider dividing the package into multiple packages with distinct BASEDIR values in their pkginfo files.

Individually Relocatable Objects

Individually relocatable objects are not restricted to the same directory location as collectively relocatable objects. To define an individually relocatable object, you need to specify an install variable in the path field in the prototype file. After specifying the install variable, create a request script to prompt the installer for the relocatable base directory, or a checkinstall script to determine the path name from file system data. For more information on request scripts, see Writing a request Script and for information on checkinstall scripts, see How to Gather File System Data.


Caution – Caution –

Individually relocatable objects are difficult to manage. Use of individually relocatable objects might result in widely scattered package components that are difficult to isolate when installing multiple versions or architectures of the package. Use collectively relocatable objects whenever possible.


Parametric Path Names

A parametric path name is a path name that includes a variable specification. For example, /opt/$PKGINST/filename is a parametric path name because of the $PKGINST variable specification. A default value for the variable specification must be defined in the pkginfo file. The value may then be changed by a request script or a checkinstall script.

A variable specification in a path must begin or end the path name, or be bounded by slashes (/). Valid parametric path names take the following form:


$PARAM/tests
tests/$PARAM/generic
/tests/$PARAM

The variable specification, once defined, may cause the path to be evaluated as absolute or relocatable. In the following example, the prototype file contains this entry:


f none $DIRLOC/tests/generic

The pkginfo file contains this entry:


DIRLOC=/myopt

The path name $DIRLOC/tests/generic evaluates to the absolute path name /myopt/tests/generic, regardless of whether the BASEDIR parameter is set in the pkginfo file.

In this example, the prototype file is identical to the one in the previous example and the pkginfo file contains the following entries:


DIRLOC=firstcut
BASEDIR=/opt

The path name $DIRLOC/tests/generic will evaluate to the relocatable path name /opt/firstcut/tests/generic.

For more information on parametric path names, see Using Parametric Base Directories.

A Brief Word on an Object's Source and Destination Locations

The path field in the prototype file defines where the object will be located on the target system. Specify the present location of the package's objects in the prototype file if their directory structure does not mimic the intended structure on the target system. See Organizing a Package's Contents for more information on structuring objects in a package.

If your development area is not structured in the same way that you want your package structured, you can use the path1=path2 format in the path field. In this format, path1 is the location the object should have on the target system, and path2 is the location the object has on your system.

You can also use the path1=path2 path name format with path1 as a relocatable object name and path2 as a full path name to that object on your system.


Note –

path1 may not contain undefined build variables, but may contain undefined install variables. path2 may not contain any undefined variables, although both build variables and install variables may be used. For information on the difference between install variables and build variables, see Package Environment Variables.


Links must use the path1= path2 format because they are created by the pkgadd command. As a general rule, path2 of a link should never be absolute, but should instead be relative to the directory portion of path1.

An option to using the path1=path2 format is to use the !search command. For more information, see Providing a Search Path for the pkgmk Command.

The mode Field

The mode field may contain an octal number, a question mark (?), or a variable specification. An octal number specifies the mode of the object when it is installed on the target system. A ? means that the mode will be unchanged as the object is installed, implying that the object of the same name already exists on the target system.

A variable specification of the form $mode, where the first letter of the variable must be a lowercase letter, means that this field will be set as the package is built. Note that this variable must be defined at build time in either the prototype file or as an option to the pkgmk command. For information on the difference between install variables and build variables, see Package Environment Variables.

Files with file type i (information file), l (hard link), and s (symbolic link) should leave this field blank.

The owner Field

The owner field may contain a user name, a question mark (?), or a variable specification. A user name has a maximum of 14 characters and should be a name that already exists on the target system (such as bin or root). A ? means that the owner will be unchanged as the object is installed, implying that the object of the same name already exists on the target system.

A variable specification can be of the form $Owner or $owner, where the first letter of the variable is either an uppercase letter or a lowercase letter. If the variable begins with a lowercase letter, it must be defined as the package is built, either in the prototype file or as an option to the pkgmk command. If the variable begins with an uppercase letter, the variable specification will be inserted into the pkginfo file as a default value, and may be redefined at install time by a request script. For information on the difference between install variables and build variables, see Package Environment Variables.

Files with file type i (information file) and lb (hard link) should leave this field blank.

The group Field

The group field may contain a group name, a question mark (?), or a variable specification. A group name has a maximum of 14 characters and should be a name that already exists on the target system (such as, bin or sys). A ? means that the group will be unchanged as the object is installed, implying that the object of the same name already exists on the target system.

A variable specification can be of the form $Group or $group, where the first letter of the variable is either an uppercase letter or a lowercase letter. If the variable begins with a lowercase letter, it must be defined as the package is built, either in the prototype file or as an option to the pkgmk command. If the variable begins with an uppercase letter, the variable specification will be inserted into the pkginfo file as a default value, and may be redefined at install time by a request script. For information on the difference between install variables and build variables, see Package Environment Variables.

Files with file type i (information file) and l (hard link) should leave this field blank.