To find which package a file belongs to in case you are trying to adjust packages and make systems consistent etc.
# pkgchk -l -p /usr/sbin/fuser
with output like so:
Pathname: /usr/sbin/fuser
Type: regular file
Expected mode: 0555
Expected owner: root
Expected group: bin
Expected file size (bytes): 7944
Expected sum(1) of contents: 558
Expected last modification: Apr 06 15:48:18 2002
Referenced by the following packages:
SUNWcsu
Current status: installed
# grep /usr/sbin/fuser /var/sadm/install/contents | awk '$2 ~ /^f$/ {print $NF}'
which will simply output:
SUNWcsu
the awk command will only match "f" in the second field which in the contents file means "file" so the above command will only work for files
To list all packages installed on a Solaris system, use:
# pkginfo
system SUNWsndmu Sendmail user
system SUNWsolnm Solaris Naming Enabler
system SUNWsprot Solaris Bundled tools
...
The output lists the category, the package name (like SUNWsprot), and a human readable name (Solaris Bundled Tools). The default categories are system and application, although additional categories can be used when making packages to simplify package management.
To limit the categories displayed when listing packages, use the -c switch:
#pkginfo -c application
The output of pkginfo will generally display pages of output, so it is convenient to pipe its output to more. When looking for a specific package, use pkgadd with the grep command to search for the name of the package or a part of its human readable name. For example:
#pkginfo | grep SUNWsndmu
#pkginfo | grep -i sendmail
The latter example uses the -i switch to make grep case insensitive, matching upper or lower case.
The pkgadd command, by default, looks for packages in the /var/spool/pkg directory. In this context, any packages that you have copied into that directory are "spooled" and waiting for installation. If there are no packages in the /var/spool/pkg directory, installation fails, as shown in the following example:
# pkgadd
pkgadd: ERROR: no packages were found in
To install packages directly from media, such as from a CD-ROM, you must use the -d option to specify a full (absolute) pathname to the directory on the device that contains the packages that you want to install.
# pkgadd -d /cdrom/sol_2_6_sparc/s0/Solaris_2.6/Product
# cd /cdrom/sol_2_6_sparc/s0/Solaris_2.6/Product
# pkgadd -d .
For example, to check the package SUNWman, the online manual pages, type pkgchk SUNWman and press Return. If the prompt comes up without any messages, the package has installed properly.
You can check the installation completeness of just the file attributes by using the -a option with the pkgchk command. You can check the installation completeness of just the file contents by using the -c option with the pkgchk command. Here is the appropriate syntax:
# /usr/sbin/pkgchk [ -a | -c ] pkgid
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment