[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 4

pkgmk Command


Produces an installable package.


pkgmk [ -c ] [ -o ] [ -a Arch ] [ -b BaseDir ] [ -d Directory ] [ -f Prototype ] [ -l Limit ] [ -p PStamp ] [ -r RootPath ] [ -v Version ] [ Variable=Value ... ] [ PkgInst ]


pkgmk produces an installable package to be used as input to the pkgadd command. A package is a collection of related files and executables that can be independently installed. The package contents will be in directory structure format.

The pkgmk command uses the package prototype file as input and creates a pkgmap file. The contents for each entry in the prototype file is copied to the appropriate output location. Information concerning the contents (checksum, file size, modification date) is computed and stored in the pkgmap file, along with attribute information specified in the prototype file.


-a Arch Overrides the architecture information provided in the pkginfo file with Arch.
-b BaseDir Prepends the indicated BaseDir to locate relocatable objects on the source machine.
-c Compresses non-information files. You must also specify the -r option when using -c. Entries in the Prototype file that reference relative paths above the RootPath specification will not be compressed. Any files that were already compressed (that is, only those in ".Z" form) before being processed by pkgmk will not be uncompressed by the pkgadd command.
-d Directory Creates the package in Directory. The directory named must already exist.
-f Prototype Uses the file Prototype as input to the command. The default name for this file is either Prototype or prototype.

You can use pkgproto to create the Prototype file. In this case, you must manually add in the entries for any installation scripts and files you are using in the package. You only need entries for those files and scripts that you use. However, you must always add an entry for the pkginfo file for the package. See pkgproto for more information.

-l Limit Specifies the maximum size in 512-byte blocks of the output device as Limit. By default, if the output file is a directory or a mountable device, pkgmk will employ the df command to dynamically calculate the amount of available space on the output device. Useful in conjunction with pkgtrans to create a package with datastream format.
-o Overwrites the same instance. The package instance will be overwritten if it already exists.
-p PStamp Overrides the production stamp definition in the pkginfo file with PStamp.
-r RootPath Appends the source pathname in the Prototype file to the indicated RootPath to locate objects on the source machine.
-v Version Overrides version information provided in the pkginfo file with Version.
Variable=Value Places the indicated variable in the packaging environment.
PkgInst A short string used to designate an abbreviation for the package name. pkgmk will automatically create a new instance if the version and/or architecture is different. A user should specify only a package abbreviation; a particular instance should not be specified unless the user is overwriting it.


  1. If you want to create a package named mypkgA containing the lsps and lsuser commands, you must first create the contents of the package. For example:
    mkdir -p /home/myuser/example/pkgmk/sbin
    cp /usr/sbin/lsps /home/myuser/example/pkgmk/sbin
    cp /usr/sbin/lsuser /home/myuser/example/pkgmk/sbin
    Then, create the pkginfo file. In this example the pkginfo file is /home/myuser/example/pkgmk/pkginfo, which contains the following:
    NAME="My Package A"
    PSTAMP="AIX  2001/02/05"
    Then, create the Prototype file, /home/myuser/example/pkgmk/prototype file which contains the following:
    !search /home/myuser/example/pkgmk/sbin
    i pkginfo=/home/myuser/example/pkgmk/pkginfo
    d example /example 1777 bin bin
    d example /example/pkgmk 1777 bin bin
    d example /example/pkgmk/sbin 1777 bin bin
    f example /example/pkgmk/sbin/lsps 555 bin bin
    f example /example/pkgmk/sbin/lsuser 555 bin bin
    Then, create the package with the above Prototype and pkginfo files using the pkgmk command:
    pkgmk -d /tmp -f /home/myuser/example/pkgmk/prototype
    This produces the following output:
    Building pkgmap from package prototype file
    ## Processing pkginfo file
        WARNING:parameter <CLASSES> set to "example"
    ## Attempting to volumize 5 entries in pkgmap
    Part  1 -- 218 blocks, 10 entries
    ## Packaging complete
    The newly created package named mypkgA now exists in /tmp/mypkgA.

Exit Status

0 Successful completion of script.
1 Fatal error. Installation process is terminated at this point.
99 Internal error.


/usr/sbin/pkgmk Contains the pkgmk command.

Related Information

The installp command, pkgadd command, pkgask command, pkgchk command, pkginfo command, pkgparam command, pkgproto command, pkgrm command, pkgtrans command, tar command.

The pkginfo file format.

For information about preparing applications to be installed using the installp command, refer to Packaging Software for Installation in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]