2573N/A.. CDDL HEADER START
2573N/A
2573N/A.. The contents of this file are subject to the terms of the
2573N/A Common Development and Distribution License (the "License").
2573N/A You may not use this file except in compliance with the License.
2573N/A
2573N/A.. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2573N/A or http://www.opensolaris.org/os/licensing.
2573N/A See the License for the specific language governing permissions
2573N/A and limitations under the License.
2573N/A
2573N/A.. When distributing Covered Code, include this CDDL HEADER in each
2573N/A file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2573N/A If applicable, add the following below this CDDL HEADER, with the
2573N/A fields enclosed by brackets "[]" replaced with your own identifying
2573N/A information: Portions Copyright [yyyy] [name of copyright owner]
2573N/A
2573N/A.. CDDL HEADER END
2573N/A
2573N/A.. Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2573N/A
2573N/A
2585N/AAppendix B
2573N/A----------
2573N/A
2573N/AConverting SVR4 Packages to IPS
2573N/A...............................
2573N/A
2573N/AThis appendix covers conversion of packages from SVR4 to IPS and highlights some
2573N/Aaspects of the conversion that should be given special attention.
2573N/A
2573N/A*Chapter 4* goes into detail on how to package software in IPS. Developers
2573N/Awith build environments that currently produce SVR4 packages should convert
2585N/Atheir build processes following the example in that chapter, rather
2585N/Athan continuing to build SVR4 packages then converting those packages to IPS.
2573N/A
2573N/AAs with *Chapter 4*, the fundamental steps to packaging any software in IPS
2573N/Aare:
2573N/A
2585N/A* Generate a package manifest.
2585N/A* Add necessary metadata to the generated manifest.
2585N/A* Evaluate dependencies.
2585N/A* Add any facets or actuators that are needed.
2585N/A* Check the package with |pkglint|.
2585N/A* Publish the package.
2585N/A* Test the package.
2573N/A
2573N/AThese steps remain essentially the same for SVR4 to IPS conversion and we will
2585N/Anot repeat their explanations. There are a few steps that warrant more
2585N/Adetailed explanations, and which are covered in this appendix.
2573N/A
2585N/AIn this appendix, a sample SVR4 package which is similar to
2585N/Athe IPS package created in *Chapter 4* is used.
2573N/A
2585N/AGenerate a Package Manifest
2573N/A~~~~~~~~~~~~~~~~~~~~~~~~~~~
2573N/A
2585N/A``pkgsend generate`` has support for scanning several different sources in
2573N/Aorder to generate manifests. In *Chapter 4*, we used a simple directory as the
2585N/Asource. The |pkgsend| utility can also read SVR4 packages, consulting the
2585N/A|pkgmap| file in that package, rather than the directory inside the package that
2585N/Acontains the files delivered.
2573N/A
2585N/AWhile scanning the ``prototype`` file, |pkgsend| also looks for entries that could
2585N/Acause problems when converting the package to IPS. The |pkgsend| utility
2585N/Areports those problems and prints the generated manifest.
2573N/A
2585N/AIn this example, a SVR4 package will be used that has a ``pkginfo`` file::
2573N/A
2573N/A VENDOR=My Software Inc.
2573N/A HOTLINE=Please contact your local service provider
2573N/A PKG=MSFTmypkg
2573N/A ARCH=i386
2573N/A DESC=A sample SVR4 package of My Sample Package
2573N/A CATEGORY=system
2573N/A NAME=My Sample Package
2573N/A BASEDIR=/
2573N/A VERSION=11.11,REV=2011.10.17.14.08
2573N/A CLASSES=none manpage
2573N/A PSTAMP=linn20111017132525
2573N/A MSFT_DATA=Some extra package metadata
2573N/A
2573N/A.. raw:: pdf
2573N/A
2573N/A PageBreak
2573N/A
2573N/Aand a corresponding ``prototype`` file::
2573N/A
2573N/A i pkginfo
2573N/A i copyright
2573N/A i postinstall
2573N/A d none opt 0755 root bin
2573N/A d none opt/mysoftware 0755 root bin
2573N/A d none opt/mysoftware/lib 0755 root bin
2573N/A f none opt/mysoftware/lib/mylib.so.1 0644 root bin
2573N/A d none opt/mysoftware/bin 0755 root bin
2573N/A f none opt/mysoftware/bin/mycmd 0755 root bin
2573N/A d none opt/mysoftware/man 0755 root bin
2573N/A d none opt/mysoftware/man/man1 0755 root bin
2573N/A f none opt/mysoftware/man/man1/mycmd.1 0644 root bin
2573N/A
2585N/ARunning |pkgsend| on the SVR4 package built using these files, the following
2585N/AIPS manifest is generated::
2573N/A
2573N/A $ pkgsend generate ./MSFTmypkg | pkgfmt
2573N/A pkgsend generate: ERROR: script present in MSFTmypkg: postinstall
2573N/A
2573N/A set name=pkg.summary value="My Sample Package"
2573N/A set name=pkg.description value="A sample SVR4 package of My Sample Package"
2573N/A set name=pkg.send.convert.msft-data value="Some extra package metadata"
2585N/A dir path=opt owner=root group=bin mode=0755
2573N/A dir path=opt/mysoftware owner=root group=bin mode=0755
2573N/A dir path=opt/mysoftware/bin owner=root group=bin mode=0755
2573N/A file reloc/opt/mysoftware/bin/mycmd path=opt/mysoftware/bin/mycmd owner=root \
2573N/A group=bin mode=0755
2573N/A dir path=opt/mysoftware/lib owner=root group=bin mode=0755
2573N/A file reloc/opt/mysoftware/lib/mylib.so.1 path=opt/mysoftware/lib/mylib.so.1 \
2573N/A owner=root group=bin mode=0644
2573N/A dir path=opt/mysoftware/man owner=root group=bin mode=0755
2573N/A dir path=opt/mysoftware/man/man1 owner=root group=bin mode=0755
2573N/A file reloc/opt/mysoftware/man/man1/mycmd.1 \
2573N/A path=opt/mysoftware/man/man1/mycmd.1 owner=root group=bin mode=0644
2573N/A legacy pkg=MSFTmypkg arch=i386 category=system \
2573N/A desc="A sample SVR4 package of My Sample Package" \
2573N/A hotline="Please contact your local service provider" \
2573N/A name="My Sample Package" vendor="My Software Inc." \
2573N/A version=11.11,REV=2011.10.17.14.08
2573N/A license install/copyright license=MSFTmypkg.copyright
2573N/A
2585N/AThere are several points to note in the output above:
2573N/A
2585N/A * The ``pkg.summary`` and ``pkg.description`` attributes were automatically
2585N/A created, using the data from the ``pkginfo`` file.
2573N/A
2585N/A * A ``set`` action was generated from the extra parameter in ``pkginfo``
2573N/A file. These are set beneath the ``pkg.send.convert.*`` namespace, with
2585N/A the intention that developers will use |pkgmogrify| transforms to convert
2585N/A these to a more appropriate attribute name.
2573N/A
2585N/A * A ``legacy`` action was generated, using data from the SVR4 pkginfo file.
2573N/A
2585N/A * A ``license`` action was generated, pointing to the copyright file used
2585N/A in the SVR4 package.
2573N/A
2585N/A * An error message was emitted pointing to a scripting operation that can't
2585N/A be converted.
2573N/A
2585N/AChecking again, we can see a non-zero return code from ``pkgsend generate``, and
2573N/Athe error message again::
2573N/A
2573N/A $ pkgsend generate MSFTmypkg > /dev/null
2573N/A pkgsend generate: ERROR: script present in MSFTmypkg: postinstall
2573N/A $ echo $?
2573N/A 1
2573N/A
2585N/AIn this case, the package is using a ``postinstall`` script that can't be
2585N/Aconverted directly to an IPS equivalent. The script must be manually inspected.
2573N/A
2585N/AThis is the ``postinstall`` script in the package::
2573N/A
2573N/A #!/usr/bin/sh
2573N/A catman -M /opt/mysoftware/man
2573N/A
2585N/AIts effects can easily be replaced by using a ``restart_fmri`` *actuator*
2573N/Apointing to an existing SMF service, ``svc:/application/man-index:default`` as
2585N/Adescribed in *Chapter 4*. Also, see *Chapter 9* for further discussion of
2573N/Aactuators.
2573N/A
2573N/A``pkgsend generate`` will also check for the presence of class-action scripts
2573N/Aand will produce error messages indicating which scripts should be examined.
2573N/A
2573N/AIt is impossible to give examples for every package scripting scenario that a
2585N/Adeveloper can encounter when converting SVR4 packages to IPS packages. In IPS,
2585N/Athe needed functionality probably can be implemented by using an existing action
2585N/Atype or SMF service.
2573N/A
2573N/ASee *Chapter 3* for details about the *action types* available, and *Chapter 9*
2573N/Afor a discussion on *actuators*.
2573N/A
2585N/A.. raw:: pdf
2573N/A
2585N/A PageBreak
2585N/A
2585N/AVerify the Package
2585N/A~~~~~~~~~~~~~~~~~~
2573N/A
2585N/AWe'll assume that any additional package metadata needed has been added to the
2585N/Amanifest, and that dependency generation and resolution has been performed as per
2585N/A*Chapter 4*. Our next step is running |pkglint| on the package.
2573N/A
2585N/AA common source of errors when converting old SVR4 packages is mismatched
2585N/Aattributes between directories delivered in the SVR4 package and those
2585N/Adelivered by other packages on the system.
2573N/A
2585N/AIn this case, the directory action for ``/opt`` in the sample manifest
2585N/Ahas different attributes than those defined by the system packages.
2573N/A
2573N/ARecall that in *Chapter 3*, we discussed the directory action, stating that
2573N/Aall reference-counted actions must have the same attributes. When trying to
2585N/Ainstall the version of ``mypkg`` that has been generated so far, an error will
2585N/Aoccur::
2573N/A
2573N/A # pkg install mypkg
2573N/A Creating Plan /
2573N/A pkg install: The requested change to the system attempts to install multiple actions
2573N/A for dir 'opt' with conflicting attributes:
2573N/A
2573N/A 1 package delivers 'dir group=bin mode=0755 owner=root path=opt':
2573N/A pkg://mypublisher/mypkg@1.0,5.11-0:20111017T020042Z
2573N/A 3 packages deliver 'dir group=sys mode=0755 owner=root path=opt':
2573N/A pkg://solaris/developer/build/onbld@0.5.11,5.11-0.175.0.0.0.1.0:20111012T010101Z
2573N/A pkg://solaris/system/core-os@0.5.11,5.11-0.175.0.0.0.1.0:20111012T023456Z
2573N/A
2573N/A These packages may not be installed together. Any non-conflicting set may
2573N/A be, or the packages must be corrected before they can be installed.
2573N/A
2585N/ATo catch the error before publishing the package, rather than at install-time,
2585N/A|pkglint| can be used with a reference repository::
2585N/A
2585N/A $ pkglint -c ./cache -r file:///scratch/solaris-repo ./mypkg.mf.res
2585N/A Lint engine setup...
2585N/A
2585N/A PHASE ITEMS
2585N/A 4 4292/4292
2585N/A Starting lint run...
2573N/A
2585N/A WARNING opensolaris.manifest001.1 Missing attribute 'org.opensolaris.consolidation' in pkg:/mypkg@1.0,5.11
2585N/A ERROR pkglint.dupaction007 path opt is reference-counted but has different attributes across 5
2585N/A duplicates: group: bin -> mypkg group: sys -> developer/build/onbld system/core-os system/ldoms/ldomsmanager
2573N/A
2585N/AIn particular, notice the error message it produces about /opt having incorrect
2585N/Aattributes. The extra ``ldomsmanager`` package that |pkglint|
2585N/Areports was in the reference package repository, but was not installed on the
2585N/Atest system, so it did not show up in the errors reported previously by
2585N/A``pkg install``.
2585N/A
2585N/AOther Considerations
2573N/A~~~~~~~~~~~~~~~~~~~~
2573N/A
2573N/AWhile it is possible to install SVR4 packages directly on a system running
2573N/AIPS, we strongly recommend against this.
2573N/A
2573N/AApart from the ``legacy`` action, described in *Chapter 3*, there are no links
2573N/Abetween the two packaging systems, and they do not reference package metadata
2573N/Afrom each other.
2573N/A
2585N/AIPS has commands such as ``pkg verify`` which can determine whether packaged
2585N/Acontent has been installed correctly. However if another packaging system
2585N/Alegitimately installs packages, or runs install scripts that modify packaged
2585N/Afiles from IPS, errors might result.
2573N/A
2585N/ACommands such as ``pkg fix`` or ``pkg revert`` could overwrite files
2585N/Athat were delivered by a SVR4 package as well as an IPS package, potentially
2585N/Acausing the packaged applications to malfunction.
2573N/A
2585N/ASimilarly, commands such as ``pkg install``, which normally check for duplicate
2585N/Aactions and common attributes on reference-counted actions, could also fail to
2573N/Adetect potential errors when files from a different packaging system conflict.
2573N/A
2585N/AWith these pitfalls in mind, and given the comprehensive package development
2585N/Atool chain in IPS, developing IPS packages instead of SVR4 packages is
2585N/Arecommended for Oracle Solaris 11.
2573N/A