[Home]Tips/Building Solaris Patches

Scalene Wiki | Tips | Recent Changes |

Difference (from prior major revision) (no other diffs)

Changed: 52,55c52,55
=== Testing a patch
0 Verify that the patch installs with patchadd: patchadd <patchid>
0 Verify that the the patch is listed correctly by showrev : showrev -p | grep <patchid>
0 Verify that the patch can be backed out with patchrm and that modified files return to their pre-patched state: patchrm <patchid>

Testing a patch



# Verify that the patch installs with patchadd: patchadd <patchid>
# Verify that the the patch is listed correctly by showrev : showrev -p | grep <patchid>
# Verify that the patch can be backed out with patchrm and that modified files return to their pre-patched state: patchrm <patchid>

Creating Solaris Patches

Background

This page has notes related to creating Solaris patches. Patches are in essence packages with associated scripts to handle standard patch functions (primarily, the ability to back out). The packages include only the files that are to be replaced via application of the patch.

Sun's document, the Application Packaging Developer's Guide [SunDoc:805-6338], contains a section about patches and provides a high level of detail.

Creating a package

Package scripts

Gather the required package scripts. The following scripts are utilized to facilitate generalized patch management - other actions typically performed by post or pre install scripts can be appended to the corresponding scripts here.

These scripts are slightly modified versions of those found in patches distributed by Sun. The only modification made to them was to substitute $SUNW_ variables with $RR_ in order to make the patch ID less misleading in the prototype file.

Package files

Create the both the prototype and pkginfo file as you would for a normal package. There are a few differences in these files when compared to a typical package:

0 The pkginfo file should be largely identical to the package it is patching. Specifically, the variables PKG, NAME, VERSION, ARCH, and CLASSES should be the same as the package. 0 Add a variable to pkginfo called RR_PATCHID (if using scripts identical to the ones above). This ID is used by the OS utilities patchadd, patchrm, and showrev. It should be in the format WWWWWW-DD, where W is a word character and D is a digit. 0 The prototype file needs to include all the scripts listed above in addition to the contents of the package. The following lines are required:

 i checkinstall=checkinstall
 i preinstall=preinstall
 i postinstall=postinstall
 i patch_checkinstall=patch_checkinstall
 i patch_postinstall=patch_postinstall
 i i.none=i.none

Building the package(s)

After creating valid package files, build the package in a temporary patch directory. Repeat this process for all packages that will be patched. For instance:

 mkdir /var/tmp/<patchid>
 pkgmk <options> -d /var/tmp/<patchid>  # creates <pkg1> in /var/tmp/<patchid>/<pkg1> 
 pkgmk <options> -d /var/tmp/<patchid>  # creates <pkg2> in /var/tmp/<patchid>/<pkg2> 
 ...
 repeat as required

Bundling the patch

In order for a patch to be installable with [=patchadd], a file named .diPatch must exist in the patch directory:

 touch /var/tmp/<patchid>/.diPatch
All that remains is making the patch easily distributable. Patches are often distributed by Sun as zip files, but this is arbitrary.
 cd /var/tmp
 zip -r <patchid>.zip <patchid>

Testing a patch

  1. Verify that the patch installs with patchadd: patchadd <patchid>
  2. Verify that the the patch is listed correctly by showrev : showrev -p | grep <patchid>
  3. Verify that the patch can be backed out with patchrm and that modified files return to their pre-patched state: patchrm <patchid>


Scalene Wiki | Tips | Recent Changes |
This page is read-only | View other revisions
Last edited August 12, 2006 20:06 by Jason (diff)
Search: