2573N/A.. The contents of this file are subject to the terms of the
2573N/A Common Development and Distribution License (the "License").
2573N/A You may not use this file except in compliance with the License.
2573N/A See the License for the specific language governing permissions
2573N/A and limitations under the License.
2573N/A.. When distributing Covered Code, include this CDDL HEADER in each
2573N/A If applicable, add the following below this CDDL HEADER, with the
2573N/A fields enclosed by brackets "[]" replaced with your own identifying
2573N/A information: Portions Copyright [yyyy] [name of copyright owner]
2573N/A.. Copyright (c) 2011, Oracle
and/or its affiliates. All rights reserved.
2525N/AThis chapter describes how administrators can modify existing packages for local
2525N/AOccasionally administrators need to override attributes or modify packages they
2525N/Adid not produce. This might be to replace a portion of the package with an
2525N/Ainternal implementation, or something as simple as removing binaries not
2525N/AWhile other packaging systems provide various mechanisms to "force"
2525N/Ainstallation, IPS focuses instead on making it easy to republish an
2585N/Aexisting package with the desired modifications. This makes upgrade
2525N/Amuch easier since new versions can be re-published with the same
2585N/Amodifications. It also enables the rest of the packaging system
2585N/Ato function normally since instead of forcing IPS to ignore changes,
2585N/Apackages reflect the correct, installed state of the system.
2525N/AOf course, running a system with a republished package can cause
2585N/Aissues with the support organization if any connection is suspected
2585N/Abetween observed problems and the modified package.
2585N/AThe basic steps are as follows:
2585N/A 1. Use |pkgrecv| to download the package to be re-published in a *raw* format
2525N/A to a specified directory. All of the files are named by their hash value,
2525N/A and the manifest is named ``manifest``. Remember to set any required
2585N/A proxy configuration in the ``http_proxy`` environment variable.
2525N/A 2. Use |pkgmogrify| to modify the manifest in the desired manner. Any
2585N/A timestamp from the internal package FMRI should be removed to prevent
2585N/A confusion during publication as it is ignored.
2525N/A If changes are significant, running the resulting package through |pkglint|,
2585N/A as shown in *Chapter 4*, is a good idea.
2573N/A 3. Republish the package with |pkgsend|. Note that this republication
2585N/A will strip the package of any signatures that are present and will
2585N/A ignore any timestamp specified by ``
pkg.fmri``. To prevent a warning
2585N/A message you might want to remove signature actions in the |pkgmogrify| step.
2585N/A If the administrator doesn't have permission to publish to the
2585N/A original source of the package, they can create a repository with
2585N/A |pkgrepo|, then use ``pkg set-publisher --search-before=<original>``
2585N/A to have the client look for packages from the new repository before
2585N/A falling back to the original publisher.
2585N/A 4. Optionally, sign the package using |pkgsign| so that internal processes can
2585N/A be followed. Packages should be signed before they are installed (even
2525N/A during testing) to prevent client caching issues.
2585N/AExample 1: Change Package Metadata
2525N/A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2525N/Ato be ‘"IPS has lots of features"’ instead of whatever was there originally,
2525N/Aand republish to our new repository::
2525N/A $ mkdir republish; cd republish
2525N/A $ cd package* # package name contains a '/', and is url-encoded.
2585N/A $ cd * # we pulled down just the latest package by default
2525N/A # delete any signature actions
2585N/A <transform signature -> drop>
2525N/A # remove timestamp from fmri so we get our own
2525N/A $ pkgmogrify manifest fix-pkg > new-manifest
2525N/A $ pkgsend -s ./mypkg publish -d . new-manifest
2585N/AExample 2: Change Package Publisher
2585N/A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2585N/AAnother common use case is to republish packages under a new publisher
2585N/AThis can be useful, for example, when consolidating the packages from several
2585N/Adifferent development teams' repositories into a single repository for
2585N/Aintegration testing, a model that was used during development of Oracle Solaris.
2525N/AAgain, this can be achieved using the steps in *Example 1*, using
2525N/A``pkgrecv --raw``, running a |pkgmogrify| transform on the resulting
2585N/Amanifest, then republishing the transformed manifest.
2585N/AA sample transform to change the publisher to "mypublisher" is::
2525N/A <transform set name=
pkg.fmri -> edit value pkg://[^/]+/ pkg://mypublisher/>
2525N/AIterating over all packages in the repository can be done with a simple shell
2585N/Ascript, that uses the output from ``pkgrecv --newest`` to process only the
2585N/Anewest packages from the repository.
2585N/AIn the script below, we've saved the transform above in a file called
2585N/Ato a new repository ``mypublisher``, changing the package publisher along the
2562N/A for package in $(pkgrecv -s ./development-repo --newest); do
2562N/A pkgrecv -s development-repo -d incoming --raw $package
2585N/A for pdir in incoming/*/* ; do
2585N/AIf necessary, we could modify this script to select only certain packages,
2562N/Amake additional changes to the versioning scheme of the packages, and show
2585N/Aprogress as it republishes each package, for example.