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

Exit Print View

Updated: July 2014
 
 

Generate an IPS Package Manifest from a SVR4 Package

The source argument of the pkgsend generate command can be a SVR4 package. See the pkgsend(1) man page for a complete list of supported sources. When source is a SVR4 package, pkgsend generate uses the pkgmap(4) file in that SVR4 package, rather than the directory inside the package that contains the files delivered.

While scanning the prototype file, the pkgsend utility also looks for entries that could cause problems when converting the package to IPS. The pkgsend utility reports those problems and prints the generated manifest.

The example SVR4 package used in this section has the following pkginfo(4) file:

VENDOR=My Software Inc.
HOTLINE=Please contact your local service provider
PKG=MSFTmypkg
ARCH=i386
DESC=A sample SVR4 package of My Sample Package
CATEGORY=system
NAME=My Sample Package
BASEDIR=/
VERSION=11.11,REV=2011.10.17.14.08
CLASSES=none manpage
PSTAMP=linn20111017132525
MSFT_DATA=Some extra package metadata

The example SVR4 package used in this section has the following corresponding prototype(4) file:

i pkginfo
i copyright
i postinstall
d none opt 0755 root bin
d none opt/mysoftware 0755 root bin
d none opt/mysoftware/lib 0755 root bin
f none opt/mysoftware/lib/mylib.so.1 0644 root bin
d none opt/mysoftware/bin 0755 root bin
f none opt/mysoftware/bin/mycmd 0755 root bin
d none opt/mysoftware/man 0755 root bin
d none opt/mysoftware/man/man1 0755 root bin
f none opt/mysoftware/man/man1/mycmd.1 0644 root bin

Running the pkgsend generate command on the SVR4 package built using these files generates the following IPS manifest:

$ pkgsend generate ./MSFTmypkg | pkgfmt
pkgsend generate: ERROR: script present in MSFTmypkg: postinstall

set name=pkg.summary value="My Sample Package"
set name=pkg.description value="A sample SVR4 package of My Sample Package"
set name=pkg.send.convert.msft-data value="Some extra package metadata"
dir path=opt owner=root group=bin mode=0755
dir path=opt/mysoftware owner=root group=bin mode=0755
dir path=opt/mysoftware/bin owner=root group=bin mode=0755
file reloc/opt/mysoftware/bin/mycmd path=opt/mysoftware/bin/mycmd owner=root \
    group=bin mode=0755
dir path=opt/mysoftware/lib owner=root group=bin mode=0755
file reloc/opt/mysoftware/lib/mylib.so.1 path=opt/mysoftware/lib/mylib.so.1 \
    owner=root group=bin mode=0644
dir path=opt/mysoftware/man owner=root group=bin mode=0755
dir path=opt/mysoftware/man/man1 owner=root group=bin mode=0755
file reloc/opt/mysoftware/man/man1/mycmd.1 \
    path=opt/mysoftware/man/man1/mycmd.1 owner=root group=bin mode=0644
legacy pkg=MSFTmypkg arch=i386 category=system \
    desc="A sample SVR4 package of My Sample Package" \
    hotline="Please contact your local service provider" \
    name="My Sample Package" vendor="My Software Inc." \
    version=11.11,REV=2011.10.17.14.08
license install/copyright license=MSFTmypkg.copyright

Note the following points regarding the pkgsend generate output:

  • The pkg.summary and pkg.description attributes were automatically created from data in the pkginfo file.

  • A set action was generated from the extra parameter in the pkginfo file. This set action is set beneath the pkg.send.convert.* namespace. Use pkgmogrify(1) transforms to convert such attributes to more appropriate attribute names.

  • A legacy action was generated from data in the pkginfo file.

  • A license action was generated that points to the copyright file used in the SVR4 package.

  • An error message was emitted regarding a scripting operation that cannot be converted.

The following check shows the error message and the non-zero return code from pkgsend generate:

$ pkgsend generate MSFTmypkg > /dev/null
pkgsend generate: ERROR: script present in MSFTmypkg: postinstall
$ echo $?
1

The SVR4 package is using a postinstall script that cannot be converted directly to an IPS equivalent. The script must be manually inspected.

The postinstall script in the package has the following content:

#!/usr/bin/sh
catman -M /opt/mysoftware/man

You can achieve the same results as this script by using a restart_fmri actuator that points to an existing SMF service, svc:/application/man-index:default, as described in Add Any Facets or Actuators That Are Needed. See Chapter 7, Automating System Change as Part of Package Installation for a thorough discussion of actuators.

The pkgsend generate command also checks for the presence of class-action scripts and produces error messages that indicate which scripts should be examined.

In any conversion of a SVR4 package to an IPS package, the needed functionality probably can be implemented by using an existing action type or SMF service. See Package Content: Actions for details about available action types. See Chapter 7, Automating System Change as Part of Package Installation for information about SMF and package actions.

Adding package metadata and resolving dependencies are done in the same way as described in Creating and Publishing a Package and therefore are not discussed in this section. The next package creation step that might present unique issues for converted packages is the verification step.