Specifying the Source of the Package

Use the -g option to temporarily add the specified package repository or package archive to the list of sources in the image from which to retrieve package data. Repositories that require a client SSL certificate cannot be used with this option. This option cannot be used in images that have child images (non-global zones). If non-global zones are installed in this image, use the pkg set-publisher command to add this publisher and origin. This option can be specified multiple times.

When you specify the -g option, publishers that are enabled in the image are preferred when retrieving packages.

  • If a package that matches the specified package name or package name pattern is available from a publisher that is enabled in the image, and if that same publisher is not found in the location specified by the -g option, the packaging system attempts to install the package from the publisher that is enabled in the image. After install or update, any packages provided by publishers not configured in the image are added to the image configuration without an origin.

  • If a package that matches the specified package name or package name pattern is available from a publisher that is enabled in the image, and if that same publisher publishes the package in the location specified by the -g option, the packaging system attempts to install the package from the location specified by the -g option.

In the following example, the btool package is available from the solaris publisher configured in the image. The btool package is also available from the devtool publisher with repository origin http://pkg.example1.com/ but the devtool publisher is not configured in the image. The command attempts to install the package from the solaris publisher because the publisher configured in the image is preferred to the -g source when the package is available from the configured publisher.

$ pkg install -g http://pkg.example1.com/ btool

To install the package from the devtool publisher, specify the publisher name in the package name.

$ pkg install -g http://pkg.example1.com/ //devtool/btool

In the following example, isvpub is a publisher configured in the image with an origin of /var/share/pkgrepos/isvrepo. The isvpub publisher also publishes packages to a repository at http://pkg.example2.com/ but that origin is not specified for the publisher configured in the image. The following command attempts to install the package from the http://pkg.example2.com/ location because the same publisher provides the package in both locations.

$ pkg install -g http://pkg.example2.com/ atool

See also the description of publisher stickiness in Adding, Modifying, or Removing Package Publishers.