'\" te
.\" Copyright 1989 AT&T
.\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved
.\" 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]
.TH pkgtrans 1 "30 Oct 2007" "SunOS 5.11" "User Commands"
.SH NAME
pkgtrans \- translate package format
.SH SYNOPSIS
.LP
.nf
\fBpkgtrans\fR [\fB-inosg\fR] [\fB-k\fR \fIkeystore\fR] [\fB-a\fR \fIalias\fR] [\fB-P\fR \fIpasswd\fR] \fIdevice1\fR \fIdevice2\fR 
     [\fIpkginst\fR]...
.fi

.SH DESCRIPTION
.sp
.LP
The \fBpkgtrans\fR utility translates an installable package from one format to
another. It translates:
.RS +4
.TP
.ie t \(bu
.el o
a file system format to a datastream
.RE
.RS +4
.TP
.ie t \(bu
.el o
a file system format to a signed datastream
.RE
.RS +4
.TP
.ie t \(bu
.el o
a datastream to a file system format
.RE
.RS +4
.TP
.ie t \(bu
.el o
one file system format to another file system format
.RE
.SH OPTIONS
.sp
.LP
The options and arguments for this command are:
.sp
.ne 2
.mk
.na
\fB\fB-a\fR \fIalias\fR\fR
.ad
.RS 15n
.rt  
Use public key certificate associated with friendlyName alias, and the
corresponding private key. See \fBKEYSTORE LOCATIONS\fR and \fBKEYSTORE AND
CERTIFICATE FORMATS\fR in \fBpkgadd\fR(1M) for more information.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-g\fR\fR
.ad
.RS 15n
.rt  
Sign resulting datastream.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-i\fR\fR
.ad
.RS 15n
.rt  
Copies only the \fBpkginfo\fR(4) and \fBpkgmap\fR(4) files.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-k\fR \fIkeystore\fR\fR
.ad
.RS 15n
.rt  
Use keystore to retrieve private key used to generate signature. If it not
specified, default locations are searched to find the specified private key
specified by \fB-a\fR. If no alias is given, and multiple keys exist in the key
store, \fBpkgtrans\fR will abort. See \fBKEYSTORE LOCATIONS\fR and \fBKEYSTORE
AND CERTIFICATE FORMATS\fR in \fBpkgadd\fR(1M) for more information on search
locations and formats.
.sp
When running as a user other than root, the default base directory for
certificate searching is \fB~/.pkg/security\fR, where \fB~\fR is the home
directory of the user invoking \fBpkgtrans\fR.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-n\fR\fR
.ad
.RS 15n
.rt  
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 \fBMAXINST\fR
variable in the \fBpkginfo\fR(4) file.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-o\fR\fR
.ad
.RS 15n
.rt  
Overwrites the same instance on the destination device. Package instance will
be overwritten if it already exists.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-P\fR \fIpasswd\fR\fR
.ad
.RS 15n
.rt  
Supply password used to decrypt the keystore. See \fBPASS PHRASE ARGUMENTS\fR
in \fBpkgadd\fR(1M) for details on the syntax of the argument to this option.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-s\fR\fR
.ad
.RS 15n
.rt  
Indicates that the package should be written to \fIdevice2\fR 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.
.RE

.SH OPERANDS
.sp
.ne 2
.mk
.na
\fB\fIdevice1\fR\fR
.ad
.RS 11n
.rt  
Indicates the source device. The package or packages on this device will be
translated and placed on \fIdevice2\fR. See DEVICE SPECIFIERS, below.
.RE

.sp
.ne 2
.mk
.na
\fB\fIdevice2\fR\fR
.ad
.RS 11n
.rt  
Indicates the destination device. Translated packages will be placed on this
device. See DEVICE SPECIFIERS, below.
.RE

.sp
.ne 2
.mk
.na
\fB\fIpkginst\fR\fR
.ad
.RS 11n
.rt  
Specifies which package instance or instances on \fIdevice1\fR should be
translated. The token \fBall\fR may be used to indicate all packages.
\fBpkginst.*\fR 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.
.sp
The asterisk character (\fB*\fR) is a special character to some shells and may
need to be escaped. In the C-Shell, the \fB*\fR must be surrounded by single
quotes (\fB\&'\fR) or preceded by a backslash (\fB\e\fR).
.RE

.SH DEVICE SPECIFIERS
.sp
.LP
Packaging tools, including \fBpkgtrans\fR, \fBpkgadd\fR(1M), and
\fBpkgchk\fR(1M), 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.
.sp
.ne 2
.mk
.na
\fBdevice\fR
.ad
.RS 16n
.rt  
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
\fB/dev/rmt/0\fR for a removable magnetic tape and \fB/floppy/floppy0\fR for
the first floppy disk on the system. \fBpkgtrans\fR 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 \fBpkgadd\fR(1M).
.RE

.sp
.ne 2
.mk
.na
\fBdevice alias\fR
.ad
.RS 16n
.rt  
Devices that have been specified in \fB/etc/device.tab\fR are eligible for
being the recipient or source of a package. Common examples of this type of
device specification are \fBspool\fR (the default package device location) and
\fBdisk1\fR. These names correspond to devices specified in
\fB/etc/device.tab\fR
.RE

.sp
.ne 2
.mk
.na
\fBdirectory\fR
.ad
.RS 16n
.rt  
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
\fBPKG\fR specification in the \fBpkginfo\fR(4) file. An example device
specification of this type is \fB/export/packages\fR.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRTranslating All Packages on the Floppy Disk
.sp
.LP
The following example translates all packages on the floppy drive
\fB/dev/diskette\fR and places the translations on \fB/tmp\fR:

.sp
.in +2
.nf
example% pkgtrans /dev/diskette /tmp all
.fi
.in -2
.sp

.LP
\fBExample 2 \fRTranslating Packages on \fB/tmp\fR
.sp
.LP
The following example translates packages \fBpkg1\fR and \fBpkg2\fR on
\fB/tmp\fR and places their translations (that is, a datastream) on the
\fB9track1\fR output device:

.sp
.in +2
.nf
example% pkgtrans /tmp 9track1 pkg1 pkg2
.fi
.in -2
.sp

.LP
\fBExample 3 \fRTranslating Packages on \fB/tmp\fR
.sp
.LP
The following example translates \fBpkg1\fR and \fBpkg2\fR on \fB/tmp\fR and
places them on the diskette in a datastream format:

.sp
.in +2
.nf
example% pkgtrans -s /tmp /dev/diskette pkg1 pkg2
.fi
.in -2
.sp

.LP
\fBExample 4 \fRCreating a Signed Package
.sp
.LP
The following example creates a signed package from \fBpkg1\fR and \fBpkg2\fR,
and reads the password from the \fB$PASS\fR environment variable:

.sp
.in +2
.nf
example% pkgtrans -sg -k /tmp/keystore.p12 -a foo \e
    -p env:PASS /tmp /tmp/signedpkg pkg1 pkg2
.fi
.in -2
.sp

.LP
\fBExample 5 \fRTranslating a Package Datastream
.sp
.LP
The following example translates a package datastream into a file system format
package:

.sp
.in +2
.nf
example%  pkgtrans /tmp/pkg1.pkg ~/tmp pkg1
.fi
.in -2
.sp

.SH ENVIRONMENT VARIABLES
.sp
.LP
The \fBMAXINST\fR variable is set in the \fBpkginfo\fR(4) file and declares the
maximum number of package instances.
.SH EXIT STATUS
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt  
Successful completion.
.RE

.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt  
An error occurred.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Interface StabilitySee below.
.TE

.sp
.LP
The command-line syntax is Evolving. The digitally-signed stream package is
Evolving.
.SH SEE ALSO
.sp
.LP
\fBpkginfo\fR(1), \fBpkgmk\fR(1), \fBpkgparam\fR(1), \fBpkgproto\fR(1),
\fBinstallf\fR(1M), \fBpkgadd\fR(1M), \fBpkgask\fR(1M), \fBpkgrm\fR(1M),
\fBremovef\fR(1M), \fBpkginfo\fR(4), \fBpkgmap\fR(4), \fBattributes\fR(5),
\fBlargefile\fR(5)
.sp
.LP
\fIApplication Packaging Developer\&'s Guide\fR
.SH NOTES
.sp
.LP
By default, \fBpkgtrans\fR does not translate any instance of a package if any
instance of that package already exists on the destination device. Using the
\fB-n\fR option creates a new instance if an instance of this package already
exists.  Using the \fB-o\fR option overwrites an instance of this package if it
already exists. Neither of these options are useful if the destination device
is a datastream.
.sp
.LP
Package commands are \fBlargefile\fR(5)-aware. They handle files larger than 2
GB in the same way they handle smaller files. In their current implementations,
\fBpkgadd\fR(1M), \fBpkgtrans\fR and other package commands can process a
datastream of  up to 4 GB.