Pages

Wednesday, April 11, 2007

Solaris tip: Retrieving the package name for a file

Q: Given a file name {with absolute path}, how do we retrieve the package name which the file belongs to?

There are at least two simple ways:
  1. Look into /var/sadm/install/contents file, or
  2. Run /usr/sbin/pkgchk with -l, -p as options and the absolute path as argument
eg.,
To find out what package /usr/sbin/fcinfo belongs to:
# grep /usr/sbin/fcinfo /var/sadm/install/contents | awk '{ print $10 }' | sort -u

SUNWfcprt
Or
# pkgchk -l -p /usr/sbin/fcinfo

Pathname: /usr/sbin/fcinfo
Type: regular file
Expected mode: 0555
Expected owner: root
Expected group: bin
Expected file size (bytes): 50784
Expected sum(1) of contents: 49262
Expected last modification: Dec 04 05:22:58 2006
Referenced by the following packages:
SUNWfcprt
Current status: installed

__________
Technorati tags:
|

No comments:

Post a Comment