Building a Package
Use the pkgmk command to build your package. This command takes all of the objects defined in the prototype file, puts them into directory format, creates the pkgmap file (replacing the prototype file), and produces an installable package to be used as input to the pkgadd command.
Using the Simplest pkgmk Command
The simplest form of this command is the pkgmk command itself, without any options. Before using the pkgmk command without options, make sure 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.
The pkgmap File
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 looks like:
$ 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 that 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 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 defining 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 enhance the time it takes to install the package.
How to Build a Package
Create a pkginfo file, if not done already.
For step-by-step instructions, see "How to Create a pkginfo File".
Create a prototype file, if not done already.
For step-by-step instructions, see "How to Create a prototype File Using the pkgproto Command".
Make your current working directory the same directory that contains your package's prototype file.
Build the package.
$ pkgmk [-o] [-a arch] [-b base-src-dir] [-d device] [-f filename] [-l limit] [-p pstamp] [-r rootpath] [-v version] [PARAM=value] [pkginst]
-o
Overwrites the existing version of the package.
-a arch
Overrides the architecture information in the pkginfo file.
-b base-src-dir
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.
-d device
Specifies that the package should be copied onto device, which may be a an absolute directory path name, diskette, or removable disk.
-f filename
Names a file, filename, that is used as your prototype file. The default names are prototype or Prototype.
-l limit
Specifies the maximum size, in 512-byte blocks, of the output device.
-p pstamp
Overrides the production stamp definition in the pkginfo file.
-r rootpath
Requests that the root directory rootpath be used to locate objects on the development system.
-v version
Overrides the version information in the pkginfo file.
PARAM=value
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.
pkginst
Specifies a package by its package abbreviation or a specific instance (for example, SUNWcadap.4).
For more information, see pkgmk(1).
Verify the contents of the package.
$ pkgchk -d pkg-dir pkg-abbrev Checking uninstalled directory format package pkg-abbrev from pkg-dir ## Checking control scripts. ## Checking package objects. ## Checking is complete. $
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".
Note - Errors should be considered very seriously; it may mean that a script needs fixing. However, a warning may just be a comment on the style of a script. Check it and move on if you disagree with the output from the pkgchk command.
Where to Go Next
If you want to add any optional information files and installation scripts to your package, see Chapter 3, Enhancing the Functionality of a Package. Otherwise, after you build the package, you should 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--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. $ |