Marius van Witzenburg We fight for our survival, we fight!

10Jul/110

How to easy CVS update your SRC and Ports tree with a simple Bash script

Check this updated post: How to easy CVS update your SRC and Ports tree with a simple Bash script (v2)

Its advised to run this in Screen, you can install it from /usr/ports/sysutils/screen.

First install a simple tool to get the fastest cvs server

pkg_add -r fastest_cvsup

Or from Ports (if you have the collection already):

cd /usr/ports/sysutils/fastest_cvsup/
make install clean

Install CVSUP

pkg_add -r cvsup-without-gui

Or from Ports (if you have the collection already):

cd /usr/ports/net/cvsup-without-gui
make install clean

Setup config and binary to easy update the repository for SRC and PORTS.

mkdir /usr/local/etc/cvsup
cd /usr/share/examples/cvsup
cp stable-supfile /usr/local/etc/cvsup
cp ports-supfile /usr/local/etc/cvsup
cp doc-supfile /usr/local/etc/cvsup
cd /usr/local/etc/cvsup

Edit stable-supfile and change:

*default release=cvs tag=RELENG_7_1

Set this to your release version.

Edit /usr/local/etc/cvsup/runcvsup and add:

#!/bin/sh
arg=$@
sType="tld,nl" # Can be: all / tld / tld,nl,de,fr,us
if SERVER=`/usr/local/bin/fastest_cvsup -q -c $sType`
then
        echo "Using server: ${SERVER}"
        case "$arg" in
        "stable")
                echo "Updating: stable"
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/stable-supfile
        ;;
        "ports")
                echo "Updating: ports"
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/ports-supfile
        ;;
        "doc")
                echo "Updating: doc"
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/doc-supfile
        ;;
        *)
                echo "Updating: all"
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/stable-supfile
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/ports-supfile
                /usr/local/bin/cvsup -L 2 -g -z -h ${SERVER} /usr/local/etc/cvsup/doc-supfile
        ;;
        esac
fi

Set the right permissions:

chmod 700 runcvsup

Link the script so it can be reached.

ln -s /usr/local/etc/cvsup/runcvsup /usr/local/bin/runcvsup
rehash

Update everything:

runcvsup

Posted by mariusvw

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.