The page explains how to match system files and the packages they belong to in Solaris 10.
How to find the Solaris 10 Package a File belongs to?
An example: You want to know which package /usr/ucb/whoami belongs to?
Option 1: Using the pkgchk Command
The pkgchk command will reveil all details about the file-
bash-3.00$ /usr/sbin/pkgchk -l -p /usr/ucb/whoami
NOTE: Couldn't lock the package database.
Pathname: /usr/ucb/whoami
Type: regular file
Expected mode: 0755
Expected owner: root
Expected group: bin
Expected file size (bytes): 5708
Expected sum(1) of contents: 49676
Expected last modification: Jan 23 03:03:26 2005 Referenced by the following packages:
SUNWscpu
Current status: installedThe note about the non locked database arises from the fact that the command hasn't been called with root privileges.
Option 2: The quick and dirty Approach
The non API way to find a SVR4 package a file belongs to seams to be the system file /var/sadm/install/contents. This is the place Solaris 10 tracks all installed files. Using grep on the file /var/sadm/install/contents is quite comfortable for bulk searches since the pkgchk command takes significant more time.
bash-3.00$ which whoami /usr/ucb/whoami bash-3.00$ grep /usr/ucb/whoami /var/sadm/install/contents /usr/ucb/whoami f none 0755 root bin 5708 49676 1106445806 SUNWscpu
The answer is SUNWscpu!
bash-3.00$ pkginfo SUNWscpu system SUNWscpu Source Compatibility, (Usr)
The file contents is normally readable by any user. No special privileges are required.
Warning: The file contents is the package database of the system. A corruption of this file will not allow anymore to install packages!
