Freebsd – How to tell which of the ports I compiled theself and which I installed from pre-compiled binary packages

freebsd

I have two FreeBSD 10.2-RELEASE systems and I'm trying to set up the second to be almost identical to the first. I don't wish to use ZFS snapshots for this task; I would just like to select, install, and compile the same software versions.

During the installation of the first system I know that I installed some binary ports by using the pkg tool and I also compiled some packages from source with make install clean in the /usr/ports/ hierarchy.

Now when I run pkg info on the first system it shows me both of these types. I'd like to know if there is any way that I could differentiate which were compiled from source, without looking back through my shell history.

I have found out that I can do pkg query -e '%a = 0' %o to find non-automatically installed packages, which must then be those that I have selected, but I still can't quite tell which I compiled from source.

Many thanks.

Best Answer

You can play with repository (%R). First try:

pkg query "%R %o" | grep unknown

Of course you can filter with awk (awk '/unknown/ {print $2}') or sed.