OpenSolaris 2009.06 Image Packaging System Guide
Previous Next

Creating and Publishing Packages to a Repository

How to Create and Publish an IPS Package

You can create several different types of IPS packages. As mentioned previously, a package is a collection of files, directories, drivers, and dependencies in a defined format. This task shows how to create a package that consists of a directory, a file, a dependency, and a name attribute. The package is then published to the repository by using the pkgsend(1) command.


Note - This example publishes the packages to the default repository, http://localhost:10000. If you are publishing a package to a repository other than the default repository, ensure that the repository is created and use the -s option with the pkgsend(1) command to specify the repository.


Before You Begin

Read the section Actions in IPS and become familiar with actions and the attributes of each action.

  1. Create a temporary directory on your system.

    $ mkdir my_tmp

  2. Change the directory to the temporary directory.

    $ cd / my_tmp

  3. Create a directory called my_package.

    $ mkdir my_package

  4. Change the directory to my_package.

    $ cd my_package

  5. Create a text file under the directory my_package.

    $ vi my_text_file


    Note - The files can be of any type. This example uses a text file.


  6. Export the directory my_package. Specify a version number and a sub-version number for the package. In this example, the my_package has a version number of 1.0 and a sub-version number of 1. Note the back quotes used in this command.

    $ eval `pkgsend open [email protected]`


    Note - Specify the package name, version number and sub-version number correctly. This cannot be changed afterward.


  7. Add attributes to the package. In this task you add a directory action with attributes of mode, owner, group, and path. Path is the key attribute for the directory action and must be specified.

    $ pkgsend add dir mode=0555 owner=root group=bin path=/etc/my_package

  8. Add the file my_text_file under the my_package directory.

    $ pkgsend add file my_package/my_text_file

  9. Add attributes to the file. In this example, you add the file action with the attributes of mode, owner, group, and path. Path is the key attribute for the file action and has to be specified.

    $ pkgsend add file my_package/my_text_file mode=0555 owner=root group=bin path=/etc/my_package


    Note - Actions can also be included in a file. This file can then be added to the current transaction by using the pkgsend include command.



    Note - The path attribute specifies the directory where the file will be created. This path should exist on the IPS client, although it can be different from the file's location on the IPS server.


  10. You have now created a package, my_package, consisting of a directory and a file.
  11. Add a dependency for this package and set a name attribute.

    $ pkgsend add depend fmri=pkg:/[email protected] type=require

    $ pkgsend add set name=description value="Example Package"


    Note - If the resources have been specified in a file, use the pkgsend include resource_filename command instead of the pkgsend add command to add the resources to the current transaction.


  12. Use the following option to close the transaction.

    $ pkgsend close

Example 6-3 Creating and Publishing a Simple Package

This example uses the pkgsend command to create and publish a package.

$ eval `pkgsend open [email protected]`
$ pkgsend add file my_package mode=0555 owner=root group=bin\
 path=/usr/bin/my_package
$ pkgsend close
More Information
Tagging Your XML Manifest File

If you have specified the actions and resources for a package in an XML file, also called the manifest, you can tag the manifest file to instruct additional services either before or after the package is installed.

For example, you can instruct a package to start an SMF service when it is installed and stop the SMF service when the package is uninstalled. Use the pkgsend command to tag your xml manifest file in the following way:

$ pkgsend add set restart_fmri=svc:/system/manifest-import:default xml_manifest

How to Publish SVR4 Packages to Your Repository

SVR4 packages can be installed directly on your system by using pkgadd(1M) and related commands. To learn more about the SVR4 packaging commands, see the Application Packaging Programmer's Guide.

SVR4 packages can be published to the IPS repository by using the pkgsend(1) command.


Note - This examples publishes the packages to the default repository, http://localhost:10000. If you are publishing a package to a repository other than the default repository, ensure that the repository is created and use the -s option with the pkgsend(1) command to specify the repository.


Before You Begin

To become familiar with the extent and limitations of the command, see The Publication Client pkgsend(1).

  1. Open the transaction.

    eval `pkgsend open svr4pkg`

  2. Include the manifest associated with the SVR4 package.

    pkgsend include ips-manifest-with-metadata

  3. Import the package.

    pkgsend import svr4pkg

  4. Close the transaction.

    pkgsend close

Previous Next