Staying on top of your ports, the easy way

I submitted this over at Soup’s BSDHound.com but I’m such a literary genius, I thought I would put it here too:

A lot of people try to claim various things are the “mother of invention”, but as ?n*x or ?BSD admins, we know the truth. And that truth is…. LAZINESS. Yep, if it weren’t for lazy admins, we wouldn’t have half of the automation scripts we have today. This affliction is what finally forced me to learn some Perl.

Keeping your ports tree and, subsequently, your installed binaries up to date can be a tedious task to say the least. To help alleviate this situation (and to help resume my laziness and boredom) I wrote up a script to automate cvsup’ing my ports tree. I’m not going to sit here and tell you that I’m a scripting genius, the syntax of the script would just call me a liar. But I will tell you that this script works for me on both 4.x, 5.x and 6.x stable systems. If you find out it works on others, or modify it to do so, drop me a line at packetmad[at]kulish[dot]com.

Anyway, back to what we we’re talking about. What this script does is cvsup your ports tree, run portupgrade -na (NO PORTS ARE INSTALLED) and generate a nice looking email report sent to the address of your choosing. It’s actually fairly well documented with in the script itself (amazing, huh?)

Here is an example report:

cvsup SUCCEEDED on Thu Nov 13 00:30:00 CST 2003!!
For host hivemind.some.net!!

PORTUPGRADE Results:
Legend: +:Upgrade / -:No Upgrade / *:Skipped / !:Failed

– security/openssl (openssl-0.9.7c)
– devel/libtool13 (libtool-1.3.5_1)
– security/openssh-portable (openssh-portable-3.7.1p2)
– lang/ruby16 (ruby-1.6.8.2003.10.15)
– lang/ruby16-shim-ruby18 (ruby-shim-ruby18-1.8.1.p2)
– shells/zsh (zsh-4.0.7)
– net/ntp (ntp-4.2.0)
– converters/libiconv (libiconv-1.9.1_3)
– textproc/expat2 (expat-1.95.6_1)
– devel/gettext (gettext-0.12.1)
– devel/gmake (gmake-3.80_1)
– net/mpich (mpich-1.2.5_2)
– net/cvsup-without-gui (cvsup-without-gui-16.1h)
+ lang/perl5.8 (perl-5.8.1_2)
– sysutils/portupgrade (portupgrade-20030723)
– misc/screen (screen-4.0.1_1)

From there you can decide what/when you want to upgrade. It makes it A LOT easier to schedule your updates between Nethack sessions this way.

A note on requirements. It needs to have cvsup-without-gui, portupgrade and Perl 5 installed to work correctly.

If you are still interested, after all this rambling, the script can be obtained from www.lanside.net ‘s download section.

Technical Goulash