bsdzone BSDZone - FreeBSD help, how-to guides, and articles.

  [ Home ]   [ Current News ]   [ Howto Archive ]   [ Books ]   [ Search ]   [ Links ]   [ Contact ]  [ About ]  


Keep ports / source up to date.
Security Tips - 16 Jul 05

Keep ports / source up to date.

This will keep your ports and source up to date, and let you know when a port is out of date.

Install portupgrade
pkg_add -r portupgrade

Install fastest_cvsup
pkg_add -r fastest_cvsup

Install cvsup-without-gui
pkg_add -r cvsup-without-gui

Then copy the example cvsup files to a convenient place, I use /root

cp /usr/share/examples/cvsup/standard-supfile /root
cp /usr/share/examples/cvsup/ports-supfile /root

Create the fastest_cvsup scripts in /usr/sbin
vi /usr/local/sbin/cvsup-standard.sh
#!/bin/sh
if SERVER=`/usr/local/bin/fastest_cvsup -q -c us`; then
/usr/local/bin/cvsup -g -L 2 -h $SERVER /root/standard-supfile
fi

vi /usr/local/sbin/cvsup-ports.sh
#!/bin/sh
if SERVER=`/usr/local/bin/fastest_cvsup -q -c us`; then
/usr/local/bin/cvsup -g -L 2 -h $SERVER /root/ports-supfile
fi
/usr/local/sbin/portsdb -Uu
/usr/local/sbin/portversion -l “<”

Change -c us to the country code where you live.

chmod 550 /usr/local/sbin/*.sh

Add these programs to /etc/crontab
30 3 * * * root /usr/sbin/cvsup-ports.sh
30 2 * * * root /usr/sbin/cvsup-standard.sh

Now anytime you build world it should be current. (Well at least until the last time the script was run)
If you haven’t killed the email the cron sends out, you should receive an email with a list of ports that are out of date.


Leave a Reply