Is there a way to compare what is in the ports tree with what is installed?

Brett Davidson brett at
Sun Nov 4 19:05:26 PST 2007

Robert Huff wrote:
> Brett Davidson writes:
>>  ie. If I had a particular version of the ports tree on a server,
>>  how could I check to see if any of the programs in that tree were
>>  actually installed?
>>  Is there a simple command or sequence of commands to do this?
> 	dir /var/d/pkg | grep <portname>
> 				Robert Huff
Ah. Not quite but thanks for telling me the location of the pkg 
directory (btw, it's var/db/

I've now worked out how to get what I want via :

cd /var/db/pkg
for i in *
MATCHES=`grep -c $i /usr/ports/INDEX-6`
if [ $MATCHES -gt 0 ]
  #echo "Pattern $i Matched $MATCHES times"
  echo "Pattern $i not matched"

In my case I was looking for files that weren't at the same revision 
level as the ports tree but both options are accounted for.

Thanks all.

Brett Davidsonls -la 
Systems Engineer
Net24 Limited
Phone: 0800 5000 24 | DDI: +64 3 962 9518
// web hosting / email hosting / data backup 
// our reputation for reliability precedes us

This transmission is for the intended addressee only and is confidential
information. If you have received this transmission in error, please
delete it and notify the sender.

More information about the freebsd-questions mailing list