<?xml version="1.0" encoding="iso-8859-1"?>
<!--Arbortext, Inc., 1988-2008, v.4002-->
<!ENTITY % ent SYSTEM "entities.ent">
%ent;
]>
<refentry id="pkgrecv-1">
<refmeta><refentrytitle>pkgrecv</refentrytitle><manvolnum>1</manvolnum>
<refmiscinfo class="date">08 Oct 2015</refmiscinfo>
<refmiscinfo class="sectdesc">&man1;</refmiscinfo>
<refmiscinfo class="software">&release;</refmiscinfo>
<refmiscinfo class="arch">generic</refmiscinfo>
<refmiscinfo class="copyright">Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.</refmiscinfo>
</refmeta>
<refnamediv>
<refname>pkgrecv</refname>
<refpurpose>Image Packaging System content retrieval utility</refpurpose>
</refnamediv>
<refsynopsisdiv><title></title>
<synopsis>/usr/bin/pkgrecv [-aknrv] [-s (<replaceable>src_path</replaceable>|<replaceable>src_uri</replaceable>)]
[-d (<replaceable>dest_path</replaceable>|<replaceable>dest_uri</replaceable>)] [-c <replaceable>cache_dir</replaceable>]
[-m <replaceable>match</replaceable>] [--mog-file <replaceable>file_path</replaceable> ...] [--raw]
[--key <replaceable>src_key</replaceable> --cert <replaceable>src_cert</replaceable>]
[--dkey <replaceable>dest_key</replaceable> --dcert <replaceable>dest_cert</replaceable>]
(<replaceable>fmri</replaceable>|<replaceable>pattern</replaceable>) ...</synopsis>
<synopsis>/usr/bin/pkgrecv [-s (<replaceable>src_path</replaceable>|<replaceable>src_uri</replaceable>)] --newest</synopsis>
<synopsis>/usr/bin/pkgrecv [-nv] [-s (<replaceable>src_path</replaceable>|<replaceable>src_uri</replaceable>)]
[-d (<replaceable>dest_path</replaceable>|<replaceable>dest_uri</replaceable>)] [-p <replaceable>publisher</replaceable>]...
[--key <replaceable>src_key</replaceable> --cert <replaceable>src_cert</replaceable>] --clone
</synopsis>
</refsynopsisdiv>
<refsect1 id="pkgrecv-1-desc" role="description"><title></title>
<para><command>pkgrecv</command> retrieves all versions of each matching
<replaceable>fmri</replaceable> or <replaceable>pattern</replaceable> from the
<literal>pkg</literal>(7) repository or package archive specified by the
<option>s</option> option and optionally republishes the retrieved packages to
the package repository or package archive specified by the <option>d</option>
option. By default, packages are retrieved in package repository format suitable
publication tools.</para>
<para>Packages that have not changed are not republished. Therefore, the time
to update an existing repository depends on the number of new and changed
packages.</para>
<para>Use the <option>m</option> option to specify whether to retrieve all
versions of each matching package, or only the newest version of each matching
package.</para>
<para>If you do not specify <literal>'*'</literal> to be retrieved, you might
want to specify the <option>r</option> option to be sure to retrieve all the
dependencies of the specified packages.</para>
<note><para>Do not use multiple instances of <command>pkgrecv</command> simultaneously
to republish packages to the same destination repository or archive. In this
case, newly received packages could contain duplicate actions.</para></note>
<para>After a <command>pkgrecv</command> operation that retrieves packages
into a <replaceable>dest_uri</replaceable>, if the <replaceable>dest_uri</replaceable> repository
must support <command>pkg search</command> operations, run <command>pkgrepo refresh</command>
on that repository to update search indexes.</para>
</refsect1>
<refsect1 role="options"><title></title>
<para>The following options are supported:</para>
<variablelist termlength="wholeline">
<varlistentry><term><option>h</option></term>
<listitem><para>Display a usage message.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>a</option></term>
<listitem><para>Store the retrieved package data in a <literal>pkg</literal>(7)
archive at the location specified by the <option>d</option> option. The file
specified by <option>d</option> cannot already exist. The <option>a</option> option
can be used only with file system based destinations. Although not required,
</literal>) is strongly suggested. The <option>a</option> option cannot be
combined with the <option>-raw</option> option.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>c</option> <replaceable>cache_dir</replaceable></term>
<listitem><para>Specify the path to a directory that will be used to cache
downloaded content. If this directory is not supplied, the client automatically
selects a cache directory. In the case where a download is interrupted, and
a cache directory was automatically chosen, use this option to resume the
download. See the “Environment Variables” section below for details
about how to set the location used for temporary data storage.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>d</option> (<replaceable>dest_path</replaceable>|<replaceable>dest_uri</replaceable>)</term>
<listitem><para>Specify the file system path or URI where the retrieved packages
should be republished. If <option>a</option> is specified, this destination
must be a package archive that does not already exist. If <option>a</option>
is not specified, this destination must be a package repository that already
exists. Use the <command>pkgrepo</command> command to create a new package
repository. If <option>d</option> is not specified, the value of <envar>PKG_DEST</envar> is
used. See “Environment Variables” below.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>k</option></term>
<listitem><para>Keep the retrieved package content compressed. This option
is ignored when republishing. Compressed package content should not be used
with <command>pkgsend</command>.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>m</option> <replaceable>match</replaceable></term>
<listitem><para>Control which versions of packages are retrieved if
<replaceable>pattern</replaceable> is specified or if
<replaceable>fmri</replaceable> is not fully specified. For this description,
the following four example packages exist in the source specified by the
<option>s</option> option. In these FMRI, the characters between the
<literal>@</literal> and the <literal>:</literal> denote the numbered package
version, and the characters from the <literal>:</literal> to the end denote the
timestamp portion of the version string.</para>
<programlisting>pkg://solaris/package/pkg@0.5.11,5.11-0.175.1.0.0.24.0:20120904T180335Z
pkg://solaris/package/pkg@0.5.11,5.11-0.175.1.0.0.24.0:20120903T170234Z
pkg://solaris/package/pkg@0.5.11,5.11-0.175.1.0.0.23.0:20120820T165108Z
pkg://solaris/package/pkg@0.5.11,5.11-0.175.1.0.0.23.0:20120819T155007Z</programlisting>
<variablelist termlength="wholeline">
<varlistentry><term><literal>all-timestamps</literal></term>
<listitem><para>Retrieve all versions of each matching <replaceable>fmri</replaceable> or <replaceable>
pattern</replaceable> (implies <literal>all-versions</literal>). This is the
default behavior if the <option>m</option> option is not specified. In the
example above, all four packages are retrieved.</para>
</listitem>
</varlistentry>
<varlistentry><term><literal>all-versions</literal></term>
<listitem><para>Retrieve the latest timestamp for each version of each matching
<replaceable>fmri</replaceable> or <replaceable>pattern</replaceable>. In the
example above, the following two packages are retrieved:</para>
<programlisting>pkg://solaris/package/pkg@0.5.11,5.11-0.175.1.0.0.24.0:20120904T180335Z
pkg://solaris/package/pkg@0.5.11,5.11-0.175.1.0.0.23.0:20120820T165108Z</programlisting>
</listitem>
</varlistentry>
<varlistentry><term><literal>latest</literal></term>
<listitem><para>Retrieve only the newest version of each matching <replaceable>fmri
</replaceable> or <replaceable>pattern</replaceable>. In the example above,
only the following package is retrieved:</para>
<programlisting>pkg://solaris/package/pkg@0.5.11,5.11-0.175.1.0.0.24.0:20120904T180335Z
</programlisting>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry><term><option>n</option></term>
<listitem><para>Perform a trial run with no changes made.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>p</option> <replaceable>publisher</replaceable></term>
<listitem><para>Only clone the specified publisher. This option can be specified multiple
times. The <option>p</option> option is valid only with the
<option>-clone</option> option.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>r</option></term>
<listitem><para>Recursively retrieve all dependencies for each matching
<replaceable>fmri</replaceable> or <replaceable>pattern</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>s</option> (<replaceable>src_path</replaceable>|<replaceable>src_uri</replaceable>)</term>
<listitem><para>Specify the file system path or URI of a <literal>pkg</literal>(7)
repository or package archive from which to receive package data. If <option>s</option> is
not specified, the value of <envar>PKG_SRC</envar> is used. See “Environment
Variables” below.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>v</option></term>
<listitem><para>Display verbose output, including the number of packages retrieved and their full FMRIs, the number of files retrieved, and the estimated size of the transfer.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>-key</option> <replaceable>src_key</replaceable></term>
<listitem><para>Specify a client SSL key file to use for package retrieval
from the source HTTPS repository.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>-cert</option> <replaceable>src_cert</replaceable></term>
<listitem><para>Specify a client SSL certificate file to use for package retrieval
from the source HTTPS repository.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>-dkey</option> <replaceable>dest_key</replaceable></term>
<listitem><para>Specify a client SSL key file to use for package publication
to the destination HTTPS repository.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>-dcert</option> <replaceable>dest_cert</replaceable></term>
<listitem><para>Specify a client SSL certificate file to use for package publication
to the destination HTTPS repository.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>-clone</option></term>
<listitem><para>Make an exact copy of the source repository. By default, the
clone operation succeeds only if publishers in the source repository are also
present in the destination. To limit the clone operation to specified publishers,
use the <option>p</option> option. Publishers specified by using the <option>p</option> option
are added to the destination repository if they are not already present. Packages
that are in the destination repository but not in the source repository are
removed. The clone operation leaves the destination repository altered if
an error occurs. Therefore, the destination repository should be in its own
ZFS dataset, and a snapshot should be created prior to performing the clone
operation.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>-mog-file</option></term>
<listitem><para>Specifies a file containing pkgmogrify(1) transforms to be
applied to the manifest of each package before it is copied to the destination
package repository. '-' can be specified to use stdin as input. If both files
and '-' are specified together, '-' will be ignored and only files specified
are used. Use of this option will automatically cause any existing package
signatures to be dropped from the package. Adding new hashable actions
such as files and licenses is not allowed. This option can be specified
multiple times. This option may not be combined with --clone.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>-newest</option></term>
<listitem><para>List the most recent versions of the packages available from
the repository specified by the <option>s</option> option. All other options
are ignored.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>-raw</option></term>
<listitem><para>Retrieve and store the raw package data in a set of directory
structures by stem and version at the location specified by <option>d</option>.
The <option>-raw</option> option can be used only with file system based destinations.
This package data can be used to conveniently modify and republish packages,
perhaps by correcting file contents or providing additional package metadata.
The <option>-raw</option> option cannot be combined with <option>a</option>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="examples"><title></title>
<example><title>List Newest Packages</title>
<para>List the newest packages available from the repository on the system
named <literal>test</literal>.</para>
pkg://solaris/system/library/freetype-2@2.4.8,5.11-0.175.1.0.0.7.1234:20120109T215840Z
pkg://solaris/system/library/math@0.5.11,5.11-0.175.0.0.0.2.1:20120921T190432Z</screen>
</example>
<example><title>Retrieve Raw Package Data</title>
<para>Receive the <literal>c++-runtime</literal> package from Example 1 in
a format suitable for use with <command>pkgsend publish</command>.</para>
<userinput>c++-runtime@0.5.11,5.11-0.175.0.0.0.2.1:20120921T190358Z</userinput>
Processing packages for publisher solaris ...
Retrieving and evaluating 1 package(s)...
PROCESS ITEMS GET (MB) SEND (MB)
pkg5.repository publisher system%2Flibrary%2Fc%2B%2B-runtime</screen>
</example>
<example><title>Retrieve Dependencies From a System</title>
from the system named <literal>test</literal>.</para>
</example>
<example><title>Retrieve Only the Latest Version</title>
<para>Receive only the latest version of the package <literal>editor/vim</literal> from the system named <literal>test</literal>.</para>
Processing packages for publisher solaris ...
Retrieving and evaluating 1 package(s)...
Retrieving packages ...
Packages to add: 1
Files to retrieve: 1557
Estimated transfer size: 9.21 MB
Packages to transfer:
editor/vim@7.3.600,5.11-0.175.1.0.0.24.0:20120904T172128Z
PROCESS ITEMS GET (MB) SEND (MB)
</example>
<example><title>Retrieve All Versions and Republish Remotely</title>
the system named <literal>test</literal> and republish it to a remote repository
on the system named <literal>remote</literal>.</para>
</example>
<example><title>Retrieve Dependencies From a Repository</title>
<screen>$ <userinput>pkgrecv -s /export/repo -d /local/repo -r editor/gnu-emacs</userinput></screen>
</example>
<example><title>Retrieve Additional Packages and Changed Content</title>
<para>Receive all packages that do not already exist and all changed content
<para>Receive all packages that do not already exist and all changed content
from the secure repository located at
</example>
<example><title>Create a Package Archive</title>
all of its dependencies from the repository located at <literal>http://example.com:10000
</literal>.</para>
</example>
<example><title>Copy Packages From an Archive to a Repository</title>
<para>Copy all of the packages in a package archive to an existing repository
</example>
<example><title>Change publisher name</title>
<para>Change the publisher name of the package 'foo' and all its
dependencies into 'extra' during republishing.</para>
(pkg://).*?(/.*) \\\1extra\\\2>' | pkgrecv -s repo1 -d repo2 --mog-file - foo
</userinput></screen>
</example>
</refsect1>
<refsect1 role="environment-variables"><title></title>
<para>The following environment variables are supported:</para>
<variablelist>
<varlistentry><term><envar>PKG_DEST</envar></term>
<listitem><para>The path of a directory to save the retrieved package to,
or the file system path or URI of a repository or package archive where the
packages will be copied.</para>
</listitem>
</varlistentry>
<varlistentry><term><envar>PKG_SRC</envar></term>
<listitem><para>A URI or file system path representing the location of a <literal>
pkg</literal>(7) repository or package archive from which to retrieve packages.</para>
</listitem>
</varlistentry>
<varlistentry><term><envar>TMPDIR</envar></term>
<listitem><para>The absolute path of the directory where temporary data should
be stored during program execution. If not set, the default is to store temporary
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="exit-status"><title></title>
<para>The following exit values are returned:</para>
<variablelist>
<varlistentry><term><returnvalue>0</returnvalue></term>
<listitem><para>Command succeeded.</para>
</listitem>
</varlistentry>
<varlistentry><term><returnvalue>1</returnvalue></term>
<listitem><para>An error occurred.</para>
</listitem>
</varlistentry>
<varlistentry><term><returnvalue>2</returnvalue></term>
<listitem><para>Invalid command line options were specified.</para>
</listitem>
</varlistentry>
<varlistentry><term><returnvalue>3</returnvalue></term>
<listitem><para>Multiple operations were requested, but only some of them
succeeded.</para>
</listitem>
</varlistentry>
<varlistentry><term><returnvalue>99</returnvalue></term>
<listitem><para>An unanticipated exception occurred.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="attributes"><title></title>
<para>See <literal>attributes</literal>(7) for descriptions of the following
attributes:</para>
<informaltable frame="all" orient="port">
<tgroup cols="2" colsep="1" rowsep="1"><colspec colname="col1" colwidth="198*"
align="left"/><colspec colname="col2" colwidth="198*" align="left"/><thead>
<row>
<entry align="center">
<para>ATTRIBUTE TYPE</para>
</entry>
<entry align="center">
<para>ATTRIBUTE VALUE</para>
</entry>
</row>
</thead>
<tbody>
<row>
<entry align="left">
<para>Availability</para>
</entry>
<entry align="left">
</entry>
</row>
<row>
<entry align="left">
<para>Interface Stability</para>
</entry>
<entry align="left">
<para>Uncommitted</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable></refsect1>
<refsect1 role="see-also"><title></title>
<para><olink targetdoc="refman" targetptr="pkgrepo-1"><citerefentry><refentrytitle>pkgrepo</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>, <olink targetdoc="refman" targetptr="pkgsend-1"><citerefentry><refentrytitle>pkgsend</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>, <olink targetdoc="refman" targetptr="pkg-7"><citerefentry><refentrytitle>pkg</refentrytitle><manvolnum>7</manvolnum></citerefentry></olink></para>
<para><olink targetdoc="CCOSP"><citetitle remap="book">Copying and Creating Package Repositories in Oracle Solaris 11.2</citetitle></olink></para>
</refsect1>
<refsect1 role="notes"><title></title>
<para>When using a file system based destination repository, any <command>pkg.depotd</command> processes that are serving that repository must be restarted after package transfer is completed for the changes to be reflected in its web interface or search responses. See <command>pkg.depotd</command>(8) for more information.</para>
</refsect1>
</refentry>