Getting Started With OpenSolaris 2008.05
Previous Next

IPS For Developers (Tasks)

This section provides information for developers who are interested in creating their own OpenSolaris repositories, and creating and publishing IPS packages andSVR4 packages.

The IPS software in the 2008.05 release of OpenSolaris enables developers to perform a variety of tasks related to creating and publishing packages. The following tasks are supported for the 2008.05 release.

How to Create Your Own OpenSolaris Repository Using pkg.depotd(1) Command

  1. Type the following command to create your repository:

    $ /usr/lib/pkg.depotd -d repository_directory -p port_value

  2. To confirm that the repository has been created, open your browser and type the following command http://localhost:port_value .
  3. Check the contents of the repository.

    $ ls repository_directory

Example 2-20 Creating Your Own Repository Using pkg.depotd

This example creates an OpenSolaris repository repository1 with a port value of 9000 and shows the content of the repository.

$ /usr/lib/pkg.depotd -d /export/home/user1/repository1 -p 9000
$ ls /export/home/user1/repository1
catalog file pkg search.dir search.pag trans updatelog

How to Create Your Own OpenSolaris Repository Using Smf Commands

  1. Become superuser.
  2. Set the value of the port.

    # svccfg -s application/pkg/server setprop pkg/port=port_value

  3. Set the value of the repository.

    # svccfg -s application/pkg/server setprop pkg/inst_root=repository_directory

  4. Refresh the repository.

    # svcadm refresh application/pkg/server

  5. Restart the repository.

    # svcadm restart application/pkg/server

  6. Open your browser and type http://localhost:port_value to confirm that the repository has been created.
  7. Check the contents of the repository.

    # ls repository_directory

Example 2-21 Creating Your OpenSolaris Repository Using smf Commands

This example creates an OpenSolaris repository repository2 with a port value of 8000 and shows the contents of the repository.

# svccfg -s application/pkg/server setprop pkg/port=8000
# svccfg -s application/pkg/server setprop pkg/inst_root=/export/home/user1/repository2
# svcadm refresh application/pkg/server
# svcadm restart application/pkg/server
# ls /export/home/user1/repository2
catalog file pkg search.dir search.pag trans updatelog

How to Create and Publish an IPS Package

There are different types of IPS packages that can be created. 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 using the pkgsend(1) command.

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 subversion number of 1. Note the back quotes used in this command.

    $ eval `pkgsend open my_package@1.0-1`


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


  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 has to be specified.

    $ pkgsend add dir mode=055 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 mode=055 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. We have now created a package my_package consisting of a directory and a file.
  11. We will add a dependency for this package and set a name attribute.

    $ pkgsend add depend fmri=pkg:/depends_on_this_package@1.0-1 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 2-22 Creating and Publishing a Simple Package

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

$ eval `pkgsend open my_package@1.0-1`
$ pkgsend add file my_package mode=0555 owner=root group=bin\
 path=/usr/bin/my_package
$ pkgsend close

How to Publish SVR4 Packages to Your Repository

SVR4 packages can be installed directly on your system by using the 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.

Before You Begin

See The Publication Client pkgsend(1) to become familiar with the workings and limitations of the command.

The default repository is http://localhost:10000. If you are publishing a package to a repository other than the default repository, ensure that the repository is created.

  • Use the following command to publish the SVR4 package to your repository. The default repository is http://localhost:10000

    $ pkgsend -s repository_url send SVR4_package_fmri

Example 2-23 Publishing a SVR4 package, SUNWitos to Your Repository

$ pkgsend -s http://localhost:9000 send SUNWitos

Previous Next