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.
- The
SUNWcstu
directory contains a file calledpkginfo
, which contains a few useful bits of information about the package. It also containspkgmap
, which lists the files in the package, and a directory calledreloc
, which contains all the actual binaries, config files - all the files that the package provides. It also has a directory calledinstall
with package-specific installation scripts. - 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 SUNWcstu # 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 SUNWcstu # pkgtrans . SUNWcstu.pkg [SUNWcstu] # ls SUNWcstu SUNWcstu.pkgHere, 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 SUNWcstu.pkg # pkgtrans SUNWcstu.pkg . [SUNWcstu] # ls SUNWcstu SUNWcstu.pkgAgain, 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.