Use the following steps to minimize disruption to clients. With this procedure, the update takes place out of sight, replacing the repository with the updated repository is fast, and clients do not need to change their solaris publisher origin or add a new origin.
Make sure you have a current snapshot of the repository to be updated.
$ zfs list -rt all rpool/VARSHARE/pkgrepos/solaris NAME USED AVAIL REFER MOUNTPOINT rpool/VARSHARE/pkgrepos/solaris 17.6G 78.4G 34K /var/share/pkgrepos/solaris rpool/VARSHARE/pkgrepos/solaris@initial 0 - 17.6G -
If you already have a snapshot of the repository, use the zfs diff command to check whether the snapshot is the same as the repository dataset.
$ zfs diff rpool/VARSHARE/pkgrepos/solaris@initial $
If the zfs diff command produces no output, then the snapshot is the same as its parent dataset, and you can use that snapshot for the update.
If the zfs diff command produces output, or if you do not have a snapshot of the repository, then take a new snapshot as shown in Step 6 in How to Explicitly Copy a Repository From the Internet. Use this new snapshot for the update.
Clone the repository snapshot to create a copy of the repository that you can update.
$ zfs clone rpool/VARSHARE/pkgrepos/solaris@initial rpool/VARSHARE/pkgrepos/solaris_tmp
The %ipsrepo in the following listing is the share from How to Enable Users to Retrieve Packages Using a File Interface.
$ zfs list -rt all rpool/VARSHARE/pkgrepos NAME USED AVAIL REFER MOUNTPOINT rpool/VARSHARE/pkgrepos 17.6G 78.4G 33K /var/share/pkgrepos rpool/VARSHARE/pkgrepos%ipsrepo - - - /var/share/pkgrepos rpool/VARSHARE/pkgrepos/solaris 17.6G 78.4G 17.6G /var/share/pkgrepos/solaris rpool/VARSHARE/pkgrepos/solaris@initial 0 - 17.6G - rpool/VARSHARE/pkgrepos/solaris_tmp 76K 78.4G 17.6G /var/share/pkgrepos/solaris_tmp
Just as you created the original repository either from a file or from an HTTP location, you can update your repository either from a file or from an HTTP location.
(Optional) To minimize the size of the repository, replace the repository rather than add packages with every repository update. Use one of the following two methods to replace the repository in the snapshot clone:
Use the --clone option of the pkgrecv command as described in "Update from a repository" below.
Remove all solaris content from the repository and add only the content that is needed to support current systems. Do not try to select a subset of repository content to remove. Remove all solaris content and then add all content that you need for current systems according to the list in Minimal Required Repository. Do not remove all content from the clone; remove only the content under the publisher/solaris directory as shown in the following command:
$ rm -rf /var/share/pkgrepos/solaris_tmp/publisher/solaris/*
Use one of the following methods to update the repository in the snapshot clone:
Specify the -v option to the install-repo.ksh script to verify the repository.
If the specified destination already contains a package repository, the content of the zip file is added to the content of the existing repository, and a pkgrepo rebuild is performed to update catalogs and indexes.
Create an .iso file from the repository .zip files using the -I option as described in Example 1, Creating a New Repository From a zip File.
$ mount -F hsfs ./sol-11_3-incr-repo.iso /mnt
Use either rsync or tar as shown in How to Copy a Repository From an iso File.
$ rsync -aP /mnt/repo/ /var/share/pkgrepos/solaris_tmp
Copy content from another repository to the repository clone. If you are copying from a secure site, ensure that the required SSL certificate and key are installed, and specify the required certificate and key options.
$ pkgrecv -s https://pkg.oracle.com/solaris/support \ -d /var/share/pkgrepos/solaris_tmp \ --key /path-to/key-file --cert /path-to/certificate-file '*'
See the pkgrecv(1) man page for more information about the pkgrecv command. Only packages that have changed are updated, so the time to update your repository can be much less than the time to populate the original repository. See the performance tips in Performance Considerations for Copying Repositories.
The --clone option of the pkgrecv command makes the repository copy significantly faster by performing a differences-only update of the destination repository instead of a series of incremental additions. The --clone option makes an exact copy of the source repository, including deleting packages from the destination repository that are not in the source repository. If you use the --clone option, make sure the source repository contains everything you need according to the list in Minimal Required Repository. If an error occurs, roll back to the most recent repository snapshot.
If the pkgrecv operation is interrupted, follow the instructions in Resuming an Interrupted Package Receive.
Use the pkgrepo verify command to verify the updated repository. See the pkgrepo(1) man page for more information about the pkgrepo verify and pkgrepo fix commands.
Catalog any new packages found in the newly updated repository and update all search indexes.
$ pkgrepo refresh -s /var/share/pkgrepos/solaris_tmp
$ zfs snapshot rpool/VARSHARE/pkgrepos/solaris_tmp@S11U3SRU2
$ svcadm disable -st pkg/server:solaris $ zfs promote rpool/VARSHARE/pkgrepos/solaris_tmp $ zfs rename rpool/VARSHARE/pkgrepos/solaris rpool/VARSHARE/pkgrepos/solaris_old $ zfs rename rpool/VARSHARE/pkgrepos/solaris_tmp rpool/VARSHARE/pkgrepos/solaris
See the svcadm(1M) man page for more information about the svcadm command.
If you are providing the repository through an HTTP interface, restart the SMF service. Be sure to specify the appropriate service instance when you restart the service.
$ svcadm restart pkg/server:solaris
When you are satisfied that your updated repository is working correctly, you can remove the old repository.
$ zfs destroy rpool/VARSHARE/pkgrepos/solaris_old