Copyright 1989 AT&T
Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
Copyright (c) 2017 Peter Tribble.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
pkgtrans [-inos] device1 device2 [pkginst]...
The pkgtrans utility translates an installable package from one format to another. It translates:
a file system format to a datastream
a datastream to a file system format
one file system format to another file system format
The options and arguments for this command are: -i
Copies only the pkginfo(5) and pkgmap(5) files.
Creates a new instance of the package on the destination device if any instance of this package already exists, up to the number specified by the MAXINST variable in the pkginfo(5) file.
Overwrites the same instance on the destination device. Package instance will be overwritten if it already exists.
Indicates that the package should be written to device2 as a datastream rather than as a file system. The default behavior is to write a file system format on devices that support both formats.
Indicates the source device. The package or packages on this device will be translated and placed on device2. See DEVICE SPECIFIERS, below.
Indicates the destination device. Translated packages will be placed on this device. See DEVICE SPECIFIERS, below.
Specifies which package instance or instances on device1 should be translated. The token all may be used to indicate all packages. pkginst.* can be used to indicate all instances of a package. If no packages are defined, a prompt shows all packages on the device and asks which to translate. The asterisk character (*) is a special character to some shells and may need to be escaped. In the C-Shell, the * must be surrounded by single quotes (') or preceded by a backslash (\e).
Packaging tools, including pkgtrans, pkgadd(8), and pkgchk(8), have options for specifying a package location by specifying the device on which it resides. Listed below are the device types that a package can be stored to and retrieved from. Note that source and destination devices cannot be the same. device
Packages can be stored to a character or block device by specifying the device identifier as the device. Common examples of this device type are /dev/rmt/0 for a removable magnetic tape and /floppy/floppy0 for the first floppy disk on the system. pkgtrans can also produce regular file system files in a stream format, which is suitable for storage on a character device, web server, or as input to pkgadd(8).
Devices that have been specified in /etc/device.tab are eligible for being the recipient or source of a package. Common examples of this type of device specification are spool (the default package device location) and disk1. These names correspond to devices specified in /etc/device.tab
Packages can be stored onto a directory by specifying an absolute path to a file system directory. The package contents reside in a directory within the specified directory. The package directory name must be identical to its PKG specification in the pkginfo(5) file. An example device specification of this type is /export/packages.
Example 1 Translating All Packages on the Floppy Disk
The following example translates all packages on the floppy drive /dev/diskette and places the translations on /tmp:
example% pkgtrans /dev/diskette /tmp all
Example 2 Translating Packages on /tmp
The following example translates packages pkg1 and pkg2 on /tmp and places their translations (that is, a datastream) on the 9track1 output device:
example% pkgtrans /tmp 9track1 pkg1 pkg2
Example 3 Translating Packages on /tmp
The following example translates pkg1 and pkg2 on /tmp and places them on the diskette in a datastream format:
example% pkgtrans -s /tmp /dev/diskette pkg1 pkg2
Example 4 Translating a Package Datastream
The following example translates a package datastream into a file system format package:
example% pkgtrans /tmp/pkg1.pkg ~/tmp pkg1
The MAXINST variable is set in the pkginfo(5) file and declares the maximum number of package instances.
Successful completion.
An error occurred.
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
Interface Stability See below. |
The command-line syntax is Evolving.
pkginfo (1), pkgmk (1), pkgparam (1), pkgproto (1), pkginfo (5), pkgmap (5), attributes (7), largefile (7), installf (8), pkgadd (8), pkgask (8), pkgrm (8), removef (8)
Application Packaging Developer's Guide
By default, pkgtrans does not translate any instance of a package if any instance of that package already exists on the destination device. Using the -n option creates a new instance if an instance of this package already exists. Using the -o option overwrites an instance of this package if it already exists. Neither of these options are useful if the destination device is a datastream.
Package commands are largefile(7)-aware. They handle files larger than 2 GB in the same way they handle smaller files. In their current implementations, pkgadd(8), pkgtrans and other package commands can process a datastream of up to 4 GB.