Here's a neat little script you can run from cron or commandline. I use
it to update the ports tree and the source tree for 5-STABLE. Feel free
to change the cvsup logging to suit (I don't log the ports, but I do log
important STABLE src stuff). Also, use the correct country for mirrors.
You need to install cvsup, portupgrade, fastest_cvsup, and if you want,
try freebsd-update. The portupgrade line at the bottom may not be
needed by many. But this way, I already have the latest ports
distfiles, if I want, so when I am ready to run portupgrade, the
download is already on my disk.
Ensure you put your cvsup files in the right place (or edit the script
below.) I run this every other day on FreeBSD 5.4. The logs help me
see what needs to be updated. (Every time it runs, it will show you
what ports could be updated. It will also show you what files were
updated in the source tree.)
my cron entry:
33 2 */2 * * /root/mydaily.sh 1>/dev/null 2>/dev/null
Weekly is like this:
33 2 * * 3 /root/mydaily.sh 1>/dev/null 2>/dev/null
***********/root/mydaily.sh*********
#!/bin/sh
#
# Billy saw something like this on 12/18/2004 at:
#http://www.oreillynet.com/pub/wlg/6041?page=last&x-order=date
#
LOGF="/var/log/cvsup.log"
exec >>${LOGF} 2>&1
echo "START @ `/bin/date`"
#use fastest_cvsup to find fastest geographically
#close mirror; I'll check Canada and the US
if SERVER=`/usr/local/bin/fastest_cvsup -Q -c ca,us`; then
echo "Using STABLE Server:" $SERVER
/usr/local/bin/cvsup -L1 -h $SERVER -l /var/log/cvs-lock-s
/root/stable-supfile
echo "STABLE done @ `/bin/date`"
else
echo "cvsup-STABLE has a fastest_cvsup problem on...`/bin/date`"
fi
if SERVER=`/usr/local/bin/fastest_cvsup -Q -c ca,us`; then
echo "Using PORTS Server:" $SERVER
/usr/local/bin/cvsup -L0 -h $SERVER -l /var/log/cvs-lock-p
/root/ports-supfile
echo "PORTS done @ `/bin/date`"
else
echo "cvsup-PORTS has a fastest_cvsup problem on...`/bin/date`"
fi
#-U (which takes a long time to execute) isn't needed
#with the fetchindex command
cd /usr/ports
make fetchindex
/usr/local/sbin/portsdb -u
######################################
# This program is nice, too. Remove two comments below to suit.
# echo "Looking for security patches"
# freebsd-update fetch
######################################
echo "The following ports need upgrading"
/usr/local/sbin/portversion -l "<"
echo ""
echo "Now downloading the new port distfiles"
/usr/local/sbin/portupgrade -OaF |grep -v "Fetching" |grep -v
"Skipping"
echo "STOP at `/bin/date`."
echo "********"
Maher Mohamed wrote:
> how can i upgrade my cvsup weekly with an auto way?
>