Packaging and Delivering Software With the Image Packaging System in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014
 
 

Test the Package

The final step in package development is to install the package to test whether the published package has been packaged properly.

To test installation without requiring root privilege, assign the test user the Software Installation profile. Use the -P option of the usermod command to assign the test user the Software Installation profile.


Note -  If this image has child images (non-global zones) installed, you cannot use the -g option with the pkg install command to test installation of this package. You must configure the mypublisher publisher in the image.

The following pkg set-publisher command adds all publishers in the my-repository repository to the list of publishers configured in this image:

$ pkg publisher
PUBLISHER    TYPE    STATUS P LOCATION
solaris      origin  online F http://pkg.oracle.com/solaris/release/
$ pkg set-publisher -p my-repository
pkg set-publisher:
  Added publisher(s): mypublisher
$ pkg publisher
PUBLISHER    TYPE    STATUS P LOCATION
solaris      origin  online F http://pkg.oracle.com/solaris/release/
mypublisher  origin  online F file:///home/username/my-repository/

Use the -nv options with the pkg install command to see what the install command will do without making any changes to the image. The following command actually installs the package:

$ pkg install mypkg
           Packages to install:  1 
       Create boot environment: No
Create backup boot environment: No
            Services to change:  1

DOWNLOAD                                  PKGS       FILES   XFER (MB)   SPEED
Completed                                  1/1         3/3     0.0/0.0  787k/s

PHASE                                          ITEMS
Installing new actions                         16/16
Updating package state database                 Done
Updating image state                            Done
Creating fast lookup database                   Done
Reading search index                            Done
Updating search index                            1/1

Examine the software that was delivered on the system:

$ find /opt/mysoftware
/opt/mysoftware
/opt/mysoftware/bin
/opt/mysoftware/bin/mycmd
/opt/mysoftware/lib
/opt/mysoftware/lib/mylib.so.1
/opt/mysoftware/man
/opt/mysoftware/man/man1
/opt/mysoftware/man/man1/mycmd.1
/opt/mysoftware/man/man-index
/opt/mysoftware/man/man-index/term.dic
/opt/mysoftware/man/man-index/term.req
/opt/mysoftware/man/man-index/term.pos
/opt/mysoftware/man/man-index/term.exp
/opt/mysoftware/man/man-index/term.doc
/opt/mysoftware/man/man-index/.index-cache
/opt/mysoftware/man/man-index/term.idx

In addition to the binaries and man page, the system has also generated the man page indexes as a result of the actuator restarting the man-index service.

The pkg info command shows the metadata that was added to the package:

$ pkg info mypkg
          Name: mypkg
       Summary: This is an example package
   Description: This is a full description of all the interesting attributes of
                this example package.
      Category: Applications/Accessories
         State: Installed
     Publisher: mypublisher
       Version: 1.0
 Build Release: 5.11
        Branch: 0
Packaging Date: July 20, 2013 00:54:52 AM 
          Size: 12.95 kB
          FMRI: pkg://mypublisher/mypkg@1.0,5.11-0:20130720T005452Z

The pkg search command returns hits when querying for files that are delivered by mypkg:

$ pkg search -l mycmd
INDEX      ACTION VALUE                    PACKAGE
basename   file   opt/mysoftware/bin/mycmd pkg:/mypkg@1.0-0