Solaris pkgtrans

I can never remember the syntax for the Solaris tool pkgtrans, so I have written it down here, as an aide memoire for myself, and - if it's useful - anyone else who needs to use this essential, but somewhat arcane utility.

There are two basic modes (which I'm interested in, at least), and it's probably worth a brief diversion into the structure of a Solaris package. I'm using the Sun CST package as an example here; the same applies to all packages.

  1. The SUNWcstu directory contains a file called pkginfo, which contains a few useful bits of information about the package. It also contains pkgmap, which lists the files in the package, and a directory called reloc, which contains all the actual binaries, config files - all the files that the package provides. It also has a directory called install with package-specific installation scripts.
  2. There is also a second format in which the package may be distributed: SUNWcstu.pkg is a single file which contains the same data in a single file. That's useful for transmitting over the internet, and other things.

You can install the filesystem-based package like this:

# ls
# pkgadd -d .
The following packages are available:
  1  SUNWcstu     Configuration and Service Tracker
                  (sparc) 3.6.0

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 
Or you can skip the selection by specifying the package name on the command line:
# pkgadd -d . SUNWcstu

You can install the single-file format like this - again, specifying the package name is an optional final argument to skip the interactive part:

# pkgadd -d SUNWcstu.pkg [SUNWcstu]

Convert Filesystem to File.pkg

To convert this format into a single file, you use a fairly similar syntax:

# ls
# pkgtrans . SUNWcstu.pkg [SUNWcstu]
# ls
Here, the first argument (".") is the path to the directory containing the package, "SUNWcstu.pkg" is the filename to be created, and if you specify the package name, it will omit the step of listing all packages in the directory and asking you to choose which package you want to translate.

Convert File.pkg to Filesystem

To convert SUNWcstu.pkg to a SUNWcstu/ directory, then the syntax is slightly easier:

# ls
# pkgtrans SUNWcstu.pkg . [SUNWcstu]
# ls
Again, you can omit the package name, and it will list the package contained in SUNWcstu.pkg for you to select, or you can include it for a totally automated approach.
Solaris pkgtrans
Share on Twitter Share on Facebook Share on LinkedIn Share on Share on StumbleUpon

Get the Book:

Buy my 600-page Shell Scripting Book...

Or from other Amazon in other countries: USA, Germany, France, Spain, Italy, Canada, Japan, India, Brazil
Or from other retailers

Buy this Tutorial in Paperback or for Kindle:

USA, UK, Germany, France, Spain, Italy
Or Kindle in these countries: Canada, Australia, Japan, India, Brazil, Mexico

Buy this Tutorial as a DRM-Free PDF

(Free Sample)

$9.99 US Dollars

£4.99 UK Pounds

€6.99 Euros

You can join our Shell Scripting community on Facebook: