Skip Navigation Links | |
Exit Print View | |
![]() |
Application Packaging Developer's Guide Oracle Solaris 10 1/13 Information Library |
The Process of Building a Package (Task Map)
General Rules on Using Environment Variables
Package Environment Variables Summary
Defining a Package Abbreviation (PKG)
Specifying a Package Architecture (ARCH)
Specifying a Package Instruction Set Architecture (SUNW_ISA)
Specifying a Package Version (VERSION)
Defining a Package Name (NAME)
Defining a Package Category (CATEGORY)
Organizing a Package's Contents
How to Organize a Package's Contents
Collectively Relocatable Objects
Individually Relocatable Objects
A Brief Word on an Object's Source and Destination Locations
Creating a prototype File From Scratch
Example--Creating a prototype File With the pkgproto Command
Fine-Tuning a prototype File Created With the pkgproto Command
Creating Object Entries With File Types v, e, x, and i
Using Multiple Class Definitions
Example--Fine-Tuning a prototype File Created Using the pkgproto Command
Adding Functionality to a prototype File
Defining Additional Objects to Be Created at Install Time
Creating Links at Install Time
Distributing Packages Over Multiple Volumes
Setting Default Values for the mode, owner, and group Fields
Providing a Search Path for the pkgmk Command
How to Create a prototype File by Using the pkgproto Command
3. Enhancing the Functionality of a Package (Tasks)
4. Verifying and Transferring a Package
5. Case Studies of Package Creation
Use the pkgmk command to build your package. The pkgmk command performs the following tasks:
Puts all the objectes defined in the prototype file into directory format.
Produces an installable package that is used as input to the pkgadd command.
The simplest form of this command is the pkgmk command without any options. Before using the pkgmk command without options, make sure that your current working directory contains the package's prototype file. The output of the command, files and directories, are written to the /var/spool/pkg directory.
When you build a package with the pkgmk command, it creates a pkgmap file that replaces the prototype file. The pkgmap file from the previous example has the following contents:
$ more pkgmap : 1 3170 1 d none SUNWcadap 0755 root sys 1 d none SUNWcadap/demo 0755 root bin 1 f none SUNWcadap/demo/file1 0555 root bin 14868 45617 837527496 1 d none SUNWcadap/lib 0755 root bin 1 f none SUNWcadap/lib/file2 0644 root bin 1551792 62372 837527499 1 d none SUNWcadap/man 0755 bin bin 1 d none SUNWcadap/man/man1 0755 bin bin 1 f none SUNWcadap/man/man1/file3.1 0444 bin bin 3700 42989 837527500 1 f none SUNWcadap/man/man1/file4.1 0444 bin bin 1338 44010 837527499 1 f none SUNWcadap/man/windex 0644 root other 157 13275 837527499 1 d none SUNWcadap/srcfiles 0755 root bin 1 f none SUNWcadap/srcfiles/file5 0555 root bin 12208 20280 837527497 1 f none SUNWcadap/srcfiles/file6 0555 root bin 12256 63236 837527497 1 i pkginfo 140 10941 837531104 $
The format of this file is very similar to the format of the prototype file. However, the pkgmap file includes the following information:
The first line indicates the number of volumes that the package spans, and the approximate size the package will be when it is installed.
For example, : 1 3170 indicates that the package spans one volume and will use approximately 3170 512-byte blocks when it is installed.
There are three additional fields that define the size, checksum, and modification time for each package object.
The package objects are listed in alphabetical order by class and by path name to reduce the time it takes to install the package.
For step-by-step instructions, see How to Create a pkginfo File.
For step-by-step instructions, see How to Create a prototype File by Using the pkgproto Command.
$ pkgmk [-o] [-a arch] [-b base-src-dir] [-d device] [-f filename] [-l limit] [-p pstamp] [-r rootpath] [-v version] [PARAM=value] [pkginst]
Overwrites the existing version of the package.
Overrides the architecture information in the pkginfo file.
Requests that base-src-dir be added to the beginning of relocatable path names when the pkgmk command is searching for objects on the development system.
Specifies that the package should be copied onto device, which may be a an absolute directory path name, diskette, or removable disk.
Names a file, filename, that is used as your prototype file. The default names are prototype or Prototype.
Specifies the maximum size, in 512-byte blocks, of the output device.
Overrides the production stamp definition in the pkginfo file.
Requests that the root directory rootpath be used to locate objects on the development system.
Overrides the version information in the pkginfo file.
Sets global environment variables. Variables beginning with lowercase letters are resolved at build time. Those beginning with uppercase letters are placed into the pkginfo file for use at install time.
Specifies a package by its package abbreviation or a specific instance (for example, SUNWcadap.4).
For more information, see the pkgmk(1) man page.
$ pkgchk -d device-name pkg-abbrev Checking uninstalled directory format package pkg-abbrev from device-name ## Checking control scripts. ## Checking package objects. ## Checking is complete. $
Specifies the location of the package. Note that device-name can be a full directory path name or the identifiers for a tape or removable disk.
Is the name of one or more packages (separated by spaces) to be checked. If omitted, the pkgchk command checks all available packages.
The pkgchk command prints what aspects of the package are being checked and displays warnings or errors, as appropriate. For more information on the pkgchk command, see Verifying the Integrity of a Package.
![]() | Caution - Errors should be considered very seriously. An error could mean that a script needs fixing. Check all errors and move on if you disagree with the output from the pkgchk command. |
Example 2-2 Building a Package
This example uses the prototype file created in Fine-Tuning a prototype File Created With the pkgproto Command.
$ cd /home/jane/InfoFiles $ pkgmk ## Building pkgmap from package prototype file. ## Processing pkginfo file. WARNING: parameter set to "system990708093144" WARNING: parameter set to "none" ## Attempting to volumize 13 entries in pkgmap. part 1 -- 3170 blocks, 17 entries ## Packaging one part. /var/spool/pkg/SUNWcadap/pkgmap /var/spool/pkg/SUNWcadap/pkginfo /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/demo/file1 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/lib/file2 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/man/man1/file3.1 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/man/man1/file4.1 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/man/windex /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/srcfiles/file5 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/srcfiles/file6 ## Validating control scripts. ## Packaging complete. $
Example 2-3 Specifying a Source Directory for Relocatable Files
If your package contains relocatable files, you can use the -b base-src-dir option to the pkgmk command to specify a path name to be added to the beginning of the relocatable path names while the package is being created. This option is useful if you haven't used the path1=path2 format for relocatable files or specified a search path with the !search command in the prototype file.
The following command builds a package with the following characteristics:
The package is built by using the sample prototype file that is created by the pkgproto command. See Example--Creating a prototype File With the pkgproto Command for more information.
The package is built without modifying the path fields.
The package adds an entry for the pkginfo file.
$ cd /home/jane/InfoFiles $ pkgmk -o -b /home/jane ## Building pkgmap from package prototype file. ## Processing pkginfo file. WARNING: parameter set to "system960716102636" WARNING: parameter set to "none" ## Attempting to volumize 13 entries in pkgmap. part 1 -- 3170 blocks, 17 entries ## Packaging one part. /var/spool/pkg/SUNWcadap/pkgmap /var/spool/pkg/SUNWcadap/pkginfo /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/demo/file1 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/lib/file2 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/man/man1/file3.1 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/man/man1/file4.1 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/man/windex /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/srcfiles/file5 /var/spool/pkg/SUNWcadap/reloc/SUNWcadap/srcfiles/file6 ## Validating control scripts. ## Packaging complete.
In this example, the package is built in the default directory, /var/spool/pkg, by specifying the -o option. This option overwrites the package that was created in Example 2-2.
Example 2-4 Specifying Different Source Directories for Information Files and Package Objects
If you put package information files (such as pkginfo and prototype) and the package objects in two different directories, you can create your package by using the -b base-src-dir and -r rootpath options to the pkgmk command. If you have your package objects in a directory called /product/pkgbin and the other package information files in a directory called /product/pkgsrc, you could use the following command to place the package in the /var/spool/pkg directory:
$ pkgmk -b /product/pkgbin -r /product/pkgsrc -f /product/pkgsrc/prototype
Optionally, you could use these commands to achieve the same result:
$ cd /product/pkgsrc $ pkgmk -o -b /product/pkgbin
In this example, the pkgmk command uses the current working directory to find the remaining parts of the package (such as the prototype and pkginfo information files).
See Also
If you want to add any optional information files and installation scripts to your package, see Chapter 3, Enhancing the Functionality of a Package (Tasks). Otherwise, after you build the package, you should verify its integrity. Chapter 4, Verifying and Transferring a Package explains how to do so, and provides step-by-step instructions on how to transfer your verified package to a distribution medium.