Creating and publishing SVR4 and IPS packages
By Jan Hlodan on Nov 28, 2008
How to Create and Publish an IPS Package
There are different types of IPS packages that can be created. 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 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 command to specify the repository. How to create a new repository, read this blog.
- Create a temporary directory on your system.
- Change the directory to the temporary directory.
- Create a directory called package.
- Change the directory to package.
- Create a text file under the directory package.
- Export the directory package. Specify a version number and a sub-version number for the package. In this example, the package has a version number of 0.5.11 and a subversion number of 5.11-0.101. Note the back quotes used in this command.
- 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.
- Add the file text_file under the package directory.
- 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.
- We have now created a package package consisting of a directory and a file.
- We will add a dependency for this package and set a name attribute.
$ pkgsend add depend fmri=pkg:/email@example.com,5.11-0.101 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.
- Use the following option to close the transaction.
$ mkdir tmp
$ cd tmp
$ mkdir package
$ cd package
$ gedit text_file
Note - The files can be of any type. This example uses a text file.
$ eval ‘pkgsend open firstname.lastname@example.org‘
Note – Specify the package name, version number and subversion number correctly. This cannot be changed afterwards.
$ pkgsend add dir mode=0555 owner=root group=bin path=/etc/package
$ pkgsend add file package/text_file
$ pkgsend add file package/text_file mode=0555 owner=root group=bin path=/etc/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.
$ pkgsend close
Creating and Publishing a Simple Package
This example uses the pkgsend command to create and publish a package.
$ eval ‘pkgsend open email@example.com,5.11-0.101‘ $ pkgsend add file package mode=0555 owner=root group=bin path=/usr bin/package $ pkgsend close
This example shows how to publish installed application nano.
Configure and install nano, e.g. into directory nano. In this directory run:
$ eval `pkgsend open firstname.lastname@example.org` $ for ITEM in `find .`; do if [ -d "$ITEM" ]; then pkgsend add dir mode=0555 owner=root group=bin path=`echo $ITEM | sed s%\\./%%`; else pkgsend add file "$ITEM" mode=0555 owner=root group=bin path=` echo $ITEM | sed s%\\./%%`;fi;done $ pkgsend close
How to Publish SVR4 Packages to Your Repository
SVR4 packages can be installed directly on your system by using the pkgadd and related commands.
SVR4 packages can be published to the IPS repository by using the pkgsend command.
- Open the transaction.
- Include the manifest associated with the SVR4 package.
- Import the package.
- Close the transaction.
$ eval ‘pkgsend open svr4pkg‘
$ pkgsend include ips-manifest-with-metadata
pkgsend import svr4pkg