Skip to content

Instantly share code, notes, and snippets.

@ghprince
Created October 12, 2012 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghprince/3878510 to your computer and use it in GitHub Desktop.
Save ghprince/3878510 to your computer and use it in GitHub Desktop.
Patch Process on Solaris

###How to make patches for test packages (or any Solaris packages) by Gordon Gao (gordon.gao@oracle.com)

Creat a folder for your patch and create the following structure (please substitube O000003-03 with your own patch id):

gogao/g3-patches/O000003-03% find .
.
./tmp
./tmp/O000003-03
./src
./src/O000003-03

Put everything you need to patch into src/O000003-03 directory:

O000003-03/src/O000003-03% find .
.
./lib
./lib/isu
./lib/isu/bin
./lib/isu/bin/ILOM
./lib/isu/bin/ILOM/snapshot.isu
./lib/btoCheck
./lib/btoCheck/CALLISTO
./lib/btoCheck/CALLISTO/pccheck.bbt
./lib/btoCheck/CALLISTO/pn.pccheck.conf
./lib/btoCheck/CALLISTO/pccheck
./lib/gen_log_check
./lib/gen_log_check/CALLISTO
./lib/gen_log_check/CALLISTO/serial
./lib/gen_log_check/CALLISTO/serial/serial_pp
./lib/gen_log_check/CALLISTO/serial/serial_tli_pp
./lib/gen_log_check/CALLISTO/sp_messages
./lib/gen_log_check/CALLISTO/sp_messages/sp_messages_pp
./cfg
./cfg/CALLISTO
./cfg/CALLISTO/eventlog_scan.cfg

Create the pkginfo file for you patch in the src/O000003-03 like the following example:

O000003-03/src/O000003-03% cat pkginfo
PKG=SUNWt3callistosw
NAME=Nexus cluster for Callisto test
CATEGORY=Nebula Application
ARCH=sparc
VERSION=3.1dev,lyle@trunk,REV=2011.03.03.10.42
SUNW_PATCHID=O000003-03

Copy and paste checkinstall script to src/O000003-03 (this script is the same for all patches, you can find it in previous patches):

O000003-03/src/O000003-03% ls -l checkinstall     
-rwxr-xr-x   1 gogao    testdev     5856 Sep 12 15:58 checkinstall

Create prototype file in src/O000003-03 by running the following command (you need to list all directories you want to patch in the command):

O000003-03/src/O000003-03% find lib cfg | pkgproto > prototype

And then modify this protoytpe file to add two lines at the beginning of the file and also fix the ownership/permission:

  • original prototype

      O000003-03/src/O000003-03% cat prototype
      d none lib 0755 gogao testdev
      d none lib/isu 0755 gogao testdev
      d none lib/isu/bin 0755 gogao testdev
      d none lib/isu/bin/ILOM 0755 gogao testdev
      f none lib/isu/bin/ILOM/snapshot.isu 0644 gogao testdev
      d none lib/gen_log_check 0755 gogao testdev
      d none lib/gen_log_check/CALLISTO 0755 gogao testdev
      d none lib/gen_log_check/CALLISTO/serial 0755 gogao testdev
      f none lib/gen_log_check/CALLISTO/serial/serial_pp 0644 gogao testdev
      f none lib/gen_log_check/CALLISTO/serial/serial_tli_pp 0644 gogao testdev
      d none lib/gen_log_check/CALLISTO/sp_messages 0755 gogao testdev
      f none lib/gen_log_check/CALLISTO/sp_messages/sp_messages_pp 0755 gogao testdev
      d none lib/btoCheck 0755 gogao testdev
      d none lib/btoCheck/CALLISTO 0755 gogao testdev
      f none lib/btoCheck/CALLISTO/pccheck 0644 gogao testdev
      f none lib/btoCheck/CALLISTO/pccheck.bbt 0644 gogao testdev
      f none lib/btoCheck/CALLISTO/pn.pccheck.conf 0644 gogao testdev
      d none cfg 0755 gogao testdev
      d none cfg/CALLISTO 0755 gogao testdev
      f none cfg/CALLISTO/eventlog_scan.cfg 0644 gogao testdev
    
  • modified prototype

      O000003-03/src/O000003-03% cat prototype
      i pkginfo
      i checkinstall
      d none lib 0755 root other
      d none lib/isu 0755 root other
      d none lib/isu/bin 0755 root other
      d none lib/isu/bin/ILOM 0755 root other
      f none lib/isu/bin/ILOM/snapshot.isu 0555 root other
      d none lib/gen_log_check 0755 root other
      d none lib/gen_log_check/CALLISTO 0755 root other
      d none lib/gen_log_check/CALLISTO/serial 0755 root other
      f none lib/gen_log_check/CALLISTO/serial/serial_pp 0555 root other
      f none lib/gen_log_check/CALLISTO/serial/serial_tli_pp 0555 root other
      d none lib/gen_log_check/CALLISTO/sp_messages 0755 root other
      f none lib/gen_log_check/CALLISTO/sp_messages/sp_messages_pp 0755 root other
      d none lib/btoCheck 0755 root other
      d none lib/btoCheck/CALLISTO 0755 root other
      f none lib/btoCheck/CALLISTO/pccheck 0555 root other
      f none lib/btoCheck/CALLISTO/pccheck.bbt 0555 root other
      f none lib/btoCheck/CALLISTO/pn.pccheck.conf 0555 root other
      d none cfg 0755 root other
      d none cfg/CALLISTO 0755 root other
      f none cfg/CALLISTO/eventlog_scan.cfg 0555 root other
    

Now you are ready to build the patch.

Go to tmp/O000003-03 and create an empty .diPatch file in it:

O000003-03/tmp/O000003-03% touch .diPatch

Go back to src/O000003-03 and build the patch with the following command (Note: you need to use full path as the parameter of -d):

O000003-03/src/O000003-03% pkgmk -d /home/gogao/g3-patches/O000003-03/tmp/O000003-03 -r .

Let's take a look at what we've got:

g3-patches/O000003-03/tmp% find .
.
./O000003-03
./O000003-03/SUNWt3callistosw
./O000003-03/SUNWt3callistosw/pkgmap
./O000003-03/SUNWt3callistosw/install
./O000003-03/SUNWt3callistosw/install/checkinstall
./O000003-03/SUNWt3callistosw/pkginfo
./O000003-03/SUNWt3callistosw/reloc
./O000003-03/SUNWt3callistosw/reloc/cfg
./O000003-03/SUNWt3callistosw/reloc/cfg/CALLISTO
./O000003-03/SUNWt3callistosw/reloc/cfg/CALLISTO/eventlog_scan.cfg
./O000003-03/SUNWt3callistosw/reloc/lib
./O000003-03/SUNWt3callistosw/reloc/lib/gen_log_check
./O000003-03/SUNWt3callistosw/reloc/lib/gen_log_check/CALLISTO
./O000003-03/SUNWt3callistosw/reloc/lib/gen_log_check/CALLISTO/sp_messages
./O000003-03/SUNWt3callistosw/reloc/lib/gen_log_check/CALLISTO/sp_messages/sp_messages_pp
./O000003-03/SUNWt3callistosw/reloc/lib/gen_log_check/CALLISTO/serial
./O000003-03/SUNWt3callistosw/reloc/lib/gen_log_check/CALLISTO/serial/serial_pp
./O000003-03/SUNWt3callistosw/reloc/lib/gen_log_check/CALLISTO/serial/serial_tli_pp
./O000003-03/SUNWt3callistosw/reloc/lib/btoCheck
./O000003-03/SUNWt3callistosw/reloc/lib/btoCheck/CALLISTO
./O000003-03/SUNWt3callistosw/reloc/lib/btoCheck/CALLISTO/pn.pccheck.conf
./O000003-03/SUNWt3callistosw/reloc/lib/btoCheck/CALLISTO/pccheck
./O000003-03/SUNWt3callistosw/reloc/lib/btoCheck/CALLISTO/pccheck.bbt
./O000003-03/SUNWt3callistosw/reloc/lib/isu
./O000003-03/SUNWt3callistosw/reloc/lib/isu/bin
./O000003-03/SUNWt3callistosw/reloc/lib/isu/bin/ILOM
./O000003-03/SUNWt3callistosw/reloc/lib/isu/bin/ILOM/snapshot.isu
./O000003-03/.diPatch

Wrap it up in a zip file and we are done:

g3-patches/O000003-03/tmp% zip -r O000003-03 O000003-03

And this O000003.zip file is the patch we just created:

g3-patches/O000003-03/tmp% ls
O000003-03      O000003-03.zip

After that you can include this patch into release descriptor using <patch> tag. Make sure you put it after the package that it is patching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment