Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

OpenSolaris 2008.11 Image Packaging System Guide
Previous Next

IPS For Developers (Tasks)

The IPS software in the 2008.11 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.11 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


    Note - If the repository_directory you have specified does not exist, it will be created for you.


  2. To confirm that the repository has been created, open your browser and type the following : https://localhost:port_v.

    If the depot server is running correctly, a message will be displayed in the browser.

  3. Check the contents of the repository.

    $ ls repository_directory

Example 5-1 Creating Your Own Repository Using pkg.depotd

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

$ /usr/lib/pkg.depotd -d /tmp/testrepo -p 11000 
[06/Nov/2008:13:43:26] INDEX Search Available
[06/Nov/2008:13:43:26] ENGINE Listening for SIGHUP.
[06/Nov/2008:13:43:26] ENGINE Listening for SIGTERM.
[06/Nov/2008:13:43:26] ENGINE Listening for SIGUSR1.
[06/Nov/2008:13:43:26] ENGINE Bus STARTING
[06/Nov/2008:13:43:26] ENGINE Started monitor thread '_TimeoutMonitor'.
[06/Nov/2008:13:43:26] ENGINE Serving on 0.0.0.0:11000
[06/Nov/2008:13:43:26] ENGINE Bus STARTED
$ 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 https://localhost:port_value to confirm that the repository has been created.
  7. Check the contents of the repository.

    # ls repository_directory

Example 5-2 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.


Note - This examples publishes the packages to the default repository, https://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 subversion number of 1. Note the back quotes used in this command.

    $ eval `pkgsend open [email protected]`


    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=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. 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:/[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 5-3 Creating and Publishing a Simple Package

This example uses the pkgsend(1) 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(1) 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 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.


Note - This examples publishes the packages to the default repository, https://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

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

  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

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire