Using BSD Administration Scripts to verify your installed ports
I recently discovered the nice set of packages provided by BSDAdminScripts. It includes a number of programs that help you validate your installed packages. It has pkg_libchk for validating that your installed programs are linked to libraries that are actually installed. pkg_validate checks the checksums of everything installed and lets you know when those don't match. Also included are portconfig and rcstart, each of which I'll cover below.
This is so far my favorite app I have found in a while. It basically lets me know which packages I need to recompile because a package that they depend on has been upgraded. For example:
> pkg_libchk diablo-jdk-1.6.0.07.02_9: /usr/local/diablo-jdk1.6.0/bin/unpack200 misses libz.so.4 diablo-jdk-1.6.0.07.02_9: /usr/local/diablo-jdk1.6.0/jre/bin/unpack200 misses libz.so.4 diablo-jdk-1.6.0.07.02_9: /usr/local/diablo-jdk1.6.0/jre/lib/amd64/libJdbcOdbc.so misses libodbcinst.so jdk-188.8.131.52p4_17: /usr/local/jdk1.6.0/jre/lib/amd64/libJdbcOdbc.so misses libodbcinst.so mediatomb-0.12.1_1: /usr/local/bin/mediatomb misses libmp4v2.so.0 net-snmp-5.5_4: /usr/local/lib/libnetsnmphelpers.so.20 misses libperl.so net-snmp-5.5_4: /usr/local/lib/libnetsnmpmibs.so.20 misses libperl.so net-snmp-5.5_4: /usr/local/lib/libnetsnmpmibs.so.20 misses libperl.so >
The above shows me that I have 4 packages that have dependencies that are out of sync. The easy solution from there is to use portupgrade -f for each of the 4 packages and recompile them. I had already cleaned up quite a mess with libgcrypt for 160 packages so this list is much smaller than when it started.
The reason I like this program so much is that it can help me find some of those weird issues where a piece of a program won't work right or something crashes on you. Many times this is because some ports are out of sync. Rather than recompile all 900+ ports I have installed which can take 18 hours, this lets me be a bit more surgical in what I do.
This program lets me know what files are wrong according to checksums or are missing according to the install manifests. Simply enough from here, I can choose to recompile any packages that are off. A while back, I managed to blow up my entire /var/db/pkg directory and had to restore from backup and then recompile what I thought was missing. Running this, I see that I still have some mess to clean up.
[tethys]:/home/rnejdl> pkg_validate csum miss package origin 7 0 GeoIP-1.4.6 net/GeoIP 6 0 adns-1.4_1 dns/adns 1 0 appres-1.0.2 x11/appres 12 0 apr-ipv6-devrandom-gdbm-db42-184.108.40.206.3.9_1 devel/apr1 2 0 arc-5.21o_1 archivers/arc 4 0 arj-3.10.22_3 archivers/arj 2 1 assp-220.127.116.11 mail/assp.new 2 0 avahi-app-0.6.27_2 net/avahi-app 3 0 bitmap-1.0.4 x11/bitmap 4 0 bullet-2.75 devel/bullet 2 0 cairo-1.8.10_1,1 graphics/cairo 3 0 cal3d-0.11.0_1 graphics/cal3d 2 0 cclient-2007e,1 mail/cclient 5 0 cegui-0.6.2b_2 graphics/cegui 1 0 consolehm-1.31_1 sysutils/consolehm 1 0 ctorrent-3.3.2_3 net-p2p/ctorrent ...
I haven't gone through and tried to clean this list up yet but when I have a bit of down time, I'll see what it does for me.
portconfig and others
This lets you issue make targets for a large number of ports all together instead of having to do each individually. There are the following programs you can use:
For example, if you wanted to do a config on all of the ports that require updating so that you don't have to have your update get stuck waiting for you later, you could do:
sudo portconfig -a
For the config dialoges of the new dependencies, run:
sudo portconfig-recursive -a
Portfetch of course would fetch your list of tarballs for you and portclean would clean the ports out.
This is similar to the service command on linux that let's you manage which services are running and not. To see a list of services, run:
[tethys]:/home/rnejdl> rcstart -s DAEMON FILESYSTEMS LOGIN NETWORKING NETWORK SERVERS abi accounting addswap adjkerntz amd apm apmd archdep atm1 atm2 atm3 auditd auto_linklocal bgfsck ...
You can use rcrestart to restart services and rconerestart for services that don't have an entry in /etc/rc.conf such as moused.