Sunday, June 3, 2007

FreeBSD Update Source

If sources are not yet installed in /usr/src, use Sysinstall to install them:
# /usr/sbin/sysinstall
Choose ConfigureDistributionsSource.
While CVSup will install the sources if they are not present, your CVSup run will go much faster (especially if you have a slow Internet connection) if you first install the sources from the CD, so that CVSup only has to make differential changes.
If not already done, install the CVSup port:
# cd /usr/ports/net/cvsup-without-gui# make && make install && make clean
Create the /usr/local/etc/cvsup/sup directory tree:
# mkdir -p /usr/local/etc/cvsup/sup
Create /usr/local/etc/cvsup/sup/supfile:
*default host=cvsup11.FreeBSD.org (Pick a mirror near you梥ee the list here)*default base=/usr/local/etc/cvsup*default prefix=/usr*default release=cvs tag=RELENG_6 (Use "RELENG_6_0" for 6.0-RELEASE)*default delete use-rel-suffix*default compresssrc-allports-all tag=.
Create the refuse file /usr/local/etc/cvsup/sup/refuse if you don't have a lot of disk space to spend on language-specific collections. See the FreeBSD Handbook article for more information about the refuse file.
Install the portupgrade utility suite to make managing ports easier:
# cd /usr/ports/sysutils/portupgrade# make && make install && make clean
Once installed. portupgrade, portinstall, and portversion can make short work of keeping your system up to date. See the portupgrade and portversion man pages for additional information.
Create /usr/local/bin/cvsrun to automate the CVSup session:
#! /bin/sh
# cvsrun - Weekly CVSup Run
echo "Subject: `hostname` weekly cvsup run"
/usr/local/bin/cvsup -g -L 2 /usr/local/etc/cvsup/sup/supfile
echo ""
if [ $# -eq 1 ] ; then
if [ $1 = "-i" ] ; then
/usr/local/sbin/portsdb -Uu 2>&1
echo
fi
fi
echo ""
echo "cvsrun done."
The '-i' flag tells the script to update the ports database. You can eliminate the 'if' statements and force a database update each time you run cvsrun, but if you're trying to update kernel or userland sources so that you can do a 'make world' or 'make kernel', the database update can take an unbearably long time...
Make the script executable by root only:
# chmod 0700 /usr/local/bin/cvsrun
Create /usr/local/bin/portreport to create a mailable port version report:
#! /bin/sh
#
# portreport - Port Version Report
echo Subject: `hostname` port version report
echo Content-type: text/html
echo
echo
echo "
"
portversion -v
echo
echo End of Report.
echo "
"
Make the script executable by root only:
# chmod 0700 /usr/local/bin/portreport
Edit /etc/crontab to run CVSup every Friday night:
# Run cvsup every Friday night at 10:00 pm.
0 22 * * 5 root /usr/local/bin/cvsrun -i sendmail root; /usr/local/bin/portreport sendmail root
If you plan on installing any software out of the ports collection before the next automated CVSup run, manually run it now to update the sources:
# /usr/local/bin/cvsrun -i