chpt14.txt revision 2573
2573N/A.. CDDL HEADER START
2525N/A
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
2573N/A.. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2573N/A or http://www.opensolaris.org/os/licensing.
2573N/A See the License for the specific language governing permissions
2573N/A and limitations under the License.
2573N/A
2573N/A.. When distributing Covered Code, include this CDDL HEADER in each
2573N/A file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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]
2525N/A
2573N/A.. CDDL HEADER END
2573N/A
2573N/A.. Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2573N/A
2573N/AChapter 14
2573N/A----------
2573N/A
2573N/APackage Republication
2573N/A.....................
2573N/A
2573N/AThis chapter describes how administrators can modify existing packages if needed
2573N/Afor local conditions.
2573N/A
2573N/AOccasionally administrators may wish or need to override attributes
2525N/Aor modify packages they did not produce. This may be to replace a
2525N/Aportion of the package with an internal implementation, or something
2525N/Aas simple as removing binaries not permitted on systems. While other
2525N/Apackaging systems provide various mechanisms to "force" installation,
2525N/Athe IPS team decided to make it easy to republish an existing package
2525N/Awith the desired modifications; this makes upgrade much easier since
2525N/Anew versions can be re-published with the same modifications. It also
2525N/Aallows the rest of the packaging system to function normally since
2525N/Ainstead of forcing IPS to ignore changes, we just change the
2573N/Apackages from the beginning.
2525N/A
2525N/AOf course, running a system with a republished package may cause
2525N/Aissues with the support organization if any connection is suspected
2525N/Abetween observed problems and the modified package.
2525N/A
2525N/AThe basic steps are as follows:
2525N/A
2525N/A 1) pkgrecv the package to be re-published in a raw format. This
2525N/A pulls down the package under the specified directory in a special
2525N/A format: all of the files are named by their hash value, and
2525N/A the manifest is named "manifest". Remember to set any needed
2525N/A proxy configuration in the http_proxy environment variable.
2525N/A
2525N/A 2) Use pkgmogrify to modify the manifest in the desired manner.
2525N/A In order to prevent problems with machines caching package
2525N/A manifests, we always recommend deleting the timestamp from
2573N/A the internal package FMRI.
2525N/A
2525N/A If changes are significant, running the resulting package
2573N/A through pkglint as shown in *Chapter 4* is a good idea.
2525N/A
2525N/A 3) Republish the package with pkgsend. Note that this republication
2525N/A will strip the package of any signatures that are present; to
2525N/A prevent a (harmless) warning message you may wish to remove
2525N/A signature actions in the pkgmogrify step.
2525N/A
2573N/A If the administrator doesn't have permission to publish to the
2573N/A original source of the package, they can create a repository with
2573N/A ``pkgrepo``, then use ``pkg set-publisher --search-before=<original>``
2573N/A to have the client look for packages from new repository, before
2573N/A falling back to the original publisher.
2573N/A
2525N/A 4) Optionally, sign the package so that internal processes can be
2525N/A followed.
2525N/A
2525N/AHere's an simple manual example, where we change the pkg.summary field
2573N/Ato be "IPS has lots of features" instead of whatever was there originally,
2573N/Aand republish to our new repository::
2525N/A
2573N/A $ mkdir republish; cd republish
2573N/A $ pkgrecv -d . --raw -s http://pkg.oracle.com/solaris/release package/pkg
2573N/A $ cd package* # package name contains a '/', and is url-encoded.
2573N/A $ cd * # we pulled down just the latest package by default
2573N/A $ cat > fix-pkg
2573N/A # change value of pkg.summary
2573N/A <transform set name=pkg.summary -> edit value '.*' "IPS has lots of features">
2573N/A # delete any signature actions
2573N/A <transform signature -> drop>
2573N/A # remove timestamp from fmri so we get our own
2573N/A <transform set name=pkg.fmri -> edit value ":20.+" "">
2573N/A ^D
2573N/A $ pkgmogrify manifest fix-pkg > new-manifest
2573N/A $ pkgrepo create ./mypkg
2573N/A $ pkgrepo -s ./mypkg add-publisher solaris
2573N/A $ pkgsend -s ./mypkg publish -d . new-manifest
2525N/A