Use (With Examples)

Examples of usage

Available packages

With the available (-a) option you get common name, package name, version and download size.

# pkgutil -a | head
9menu                CSW9menu             1.8,REV=2006.05.19         15.3 KB
a2ps                 CSWa2ps              4.13b                       1.3 MB
aalib                CSWaalib             1.4.0,REV=2008.04.13_rev=rc5 198.5 KB
achievo              CSWachievo           0.8.4                     273.6 KB
acpidump             CSWacpidump          20071116,REV=2008.05.10    20.7 KB
aggregate            CSWaggregate         1.6,REV=2008.03.22         10.4 KB
amanda               CSWamanda            2.4.4p4,REV=2005.08.05      2.3 MB
amarok               CSWamarok            1.4.8,REV=2008.02.26       12.8 MB
amavisd_new          CSWamavisdnew        2.5.2,REV=2007.08.03      656.2 KB
amsn                 CSWamsn              0.94                        2.3 MB

You can also add arguments that filter the output, it tries to match both the common name and the package name. See the example below which lists available packages with the strings "geoip" or "python" in them. This is equivalent to "pkgutil -a | egrep -i 'geoip|python'" but much easier to type.

# pkgutil -a geoip python
ap2_modgeoip         CSWap2modgeoip       1.2.5,REV=2008.10.17        16.0 KB
ap2_modpython        CSWap2modpython      3.3.1,REV=2007.10.25       389.5 KB
geoip                CSWgeoip             1.4.4,REV=2008.04.15       310.5 KB
geoip_devel          CSWgeoipdevel        1.4.4,REV=2008.04.15       160.1 KB
gnome_python         CSWgnome-python      2.0.2,REV=2004.08.09       251.4 KB
pm_geoippureperl     CSWpmgeoippureperl   1.19,REV=2008.04.16         18.7 KB
python               CSWpython            2.5.1,REV=2007.11.03        10.9 MB
python_tk            CSWpython-tk         2.5.1,REV=2007.11.03       301.3 KB

Compare packages

With compare (-c) you get your locally installed CSW packages and their version compared to the current catalog. Below is a sample listing, note that CSWripmime is a testing package that is not officially available in the catalog. This is not the same as "pkg-get -c" which will show a "Not installed" line for every package in the catalog you don't have installed, that means the listing is around 1800 lines. I always use "pkg-get -c | grep -v Not", no need for that here.

# pkgutil -c
package                   installed                 catalog
CSWmiltergreylist         4.0,REV=2008.04.03        4.0,REV=2008.05.06             
CSWrcs                    5.7,REV=2006.01.10        SAME                     
CSWripmime                1.4.0.7,REV=2008.04.11    not in catalog

As with -a you can add filters to the output. The example shows the status of packages containing "php" or "perl". Again, this is the same as "pkgutil -c | egrep -i 'php|perl'" but much easier to type.

# pkgutil -c php perl
package                   installed                 catalog
CSWap2modphp5             5.2.4,REV=2007.10.29      5.2.6,REV=2008.10.28     
CSWperl                   5.8.8,REV=2008.10.08      SAME                     
CSWphp5                   5.2.4,REV=2007.10.29      5.2.6,REV=2008.10.28     
CSWphp5gd                 5.2.4,REV=2007.10.29      5.2.6,REV=2008.10.28     
CSWphp5mysqli             5.2.4,REV=2007.10.29      5.2.6,REV=2008.10.28     
CSWpmgeoippureperl        1.19,REV=2008.04.16       SAME

Update notifications

The option email (-e) will compare your installed packages to the available ones and send you an e-mail if there's updates available for your system. You could set it up to run weekly from root's crontab like this:

0 5 * * 0 /opt/csw/bin/pkgutil -U -e nobody@foo.bar > /dev/null 2>&1

This is an example of how the e-mail looks like:

From: Super-User <root@foo.bar>
To: nobody@foo.bar
Subject: yourhostname: CSW updates available

CSWbind                   9.4.2,REV=2008.01.17      9.4.2,REV=2008.07.09_rev=p1
CSWmiltergreylist         4.0,REV=2008.04.03        4.0,REV=2008.05.06

Remove packages

This feature is to be considered experimental at this stage.

The remove (-r) option can remove a package including all dependencies that are not in use by other packages.

# pkgutil -r CSWrcs
Recursively checking catalog, may take a while...
Looking at installed CSW packages...
Examining dependencies for:
  CSWrcs (remove)
  CSWdiffutils (remove)
  CSWcommon (in use)
Removing CSWrcs
... (output of pkgrm not shown)
Removing CSWdiffutils
... (output of pkgrm not shown)

System check

You can check what pkgutil finds in your system by using syscheck (-V). Example below:

# pkgutil -V
Pkgutil         1.3
Arch            sparc
Solaris         5.9
Pkg patch       113713 (113713-25 installed)
GPG binary      /opt/csw/bin/gpg
Gzip binary     /bin/gzip
Mailx binary    /bin/mailx
MD5 binary      not found (suggestion: install CSWtextutils)
MD5 module      2.36 (primary choice for MD5)
Perl            5.008008
Perl binary     /opt/csw/bin/perl
Wget binary     /opt/csw/bin/wget
PATH            /opt/csw/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ccs/bin

Temporary site

With the temp (-t) option you can select a primary download location, the location specified with mirror in pkgutil.conf will be secondary. Downloads will try the primary location first and go on to the secondary if it has to.

You can use this if you're having problems with your normal mirror and want to use another official mirror temporarily. See example:

# grep mirror= /etc/opt/csw/pkgutil.conf
mirror=http://www.ibiblio.org/pub/packages/solaris/opencsw/current
# pkgutil -t http://ftp.math.purdue.edu/mirrors/opencsw.org/current -i perl

If you have packages you have built yourself that has dependencies to CSW packages it can be a problem to install them easily. Now you can use pkgutil for that as well. Use bldcat to create a catalog for your own packages and then place them on a web server you control. Then use "-t http://yourserver" so pkgutil can find your catalog.

# bldcat . > catalog
# pkgutil -t http://yourserver -i yourpackage

Package streams

The package stream option (-s) can build a package stream containing all dependencies for any combination of architecture and OS release regardless of what pkgutil runs on.

The following example will make a package stream including all dependencies needed for CSWbind. The package stream will contain packages for the i386 architecture and Solaris 10 regardless of host used to run pkgutil.

# pkgutil -T i386:5.10 -s bind

The example below will send a package stream including all dependencies needed for CSWbind to standard output which is piped to gzip. With "-o -" the normal output is sent to standard error and "-y" is used to skip the confirmation prompt.

# pkgutil -y -o - -s bind | gzip > bind.pkg.gz
Page tags: example use
page_revision: 7, last_edited: 1237895874|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License