LinuxCommandLibrary

pkgmk

Create installable software packages

TLDR

Make and download a package

$ pkgmk -d
copy

Install the package after making it
$ pkgmk -d -i
copy

Upgrade the package after making it
$ pkgmk -d -u
copy

Ignore the footprint when making a package
$ pkgmk -d -if
copy

Ignore the MD5 sum when making a package
$ pkgmk -d -im
copy

Update the package's footprint
$ pkgmk -uf
copy

SYNOPSIS

pkgmk [-o] [-d device] [-f prototype] [-l limit] [-p pstamp] [-r rootpath] [-v version] [-a arch] [-b base] [-i pkginst] [pkgid]

PARAMETERS

-o
    Overwrite existing. Specifies that if a package instance with the same package ID and instance already exists on the output device, it should be overwritten.

-d device
    Output device/directory. Defines the output device or directory where the package instance will be created. Default is /var/spool/pkg.

-f prototype
    Prototype file. Specifies the path to the prototype file which defines the package's contents and structure. This is a mandatory component for building a package.

-l limit
    Size limit. Sets a maximum size (in 512-byte blocks) for the package. If the package exceeds this limit, pkgmk will exit with an error.

-p pstamp
    Package stamp. Assigns a unique stamp to the package, often used for identifying specific builds or versions.

-r rootpath
    Root path. Specifies a base directory to prepend to all relative pathnames found in the prototype file. Useful for creating packages from a staging area.

-v version
    Package version. Defines a specific version string for the package, overriding any version specified in the prototype file's pkginfo entry.

-a arch
    Architecture. Defines the architecture string for the package, overriding any architecture specified in the prototype file.

-b base
    Base directory. Specifies a base directory for relocatable package contents, often used with the relocatable package class.

-i pkginst
    Package instance. Specifies a unique instance identifier for the package being created.

pkgid
    Package Identifier. The specific package identifier to build if the prototype file describes multiple packages. If omitted, pkgmk attempts to build the first package found.

DESCRIPTION

pkgmk is a command-line utility used to create an installable software package from a defined set of files and scripts. It operates according to the System V Release 4 (SVr4) packaging standard. The core input for pkgmk is a prototype file, which acts as a manifest. This file specifies every component of the package: files, directories, symbolic links, devices, and package-specific installation scripts (e.g., preinstall, postinstall, request scripts).

The command collects the specified files from the source directory, applies attributes like permissions and ownership defined in the prototype, and bundles them into a package instance. This package instance is typically stored in a spool directory (like /var/spool/pkg) and is then ready for installation using the pkgadd command.

While central to older System V Unix systems like Solaris and HP-UX, pkgmk is less common on modern Linux distributions, which predominantly use RPM or Deb packages. However, understanding pkgmk is crucial for environments maintaining legacy SVr4 package management.

CAVEATS

Primarily found and used on System V Release 4 (SVr4) based Unix systems such as Solaris, HP-UX, and AIX. It is not standard on most mainstream Linux distributions, which use RPM or Deb package formats.

Requires a meticulously prepared prototype file; errors in this file can lead to incorrect or failed package builds.

Building packages might require appropriate write permissions to the designated output device or directory.

THE PROTOTYPE FILE

The prototype file is the blueprint for the package. It defines the type of each entry (file, directory, link, device), its source path, target path within the package, permissions, owner, group, and any associated install scripts. pkgmk parses this file to understand what to include and how to package it.

PACKAGE SPOOL

pkgmk typically creates the package instance in a designated spool area (e.g., /var/spool/pkg). This location serves as a repository for pre-built packages, making them readily available for installation by pkgadd.

HISTORY

pkgmk is an integral part of the System V Release 4 (SVr4) Package Management System, originally developed by AT&T and Unix System Laboratories (USL). This packaging standard was a significant advancement in software distribution for Unix systems during the late 1980s and early 1990s.

While SVr4 packaging tools, including pkgmk, remain crucial for systems like Solaris, HP-UX, and AIX, their direct usage on Linux became less prevalent with the rise of the Red Hat Package Manager (RPM) and Debian packages (.deb) which offered different approaches to software management. Despite this, the underlying concepts of package manifests and lifecycle scripts have influenced modern packaging systems.

SEE ALSO

pkgadd(1), pkginfo(1), pkgrm(1), prototype(4)

Copied to clipboard