# ==================================================== # ecvs : Easy CVS # Helps OpenBSD newbies to upgrade ports or sources # via cvs(1) # # January 22 2004 -- 20:52 +01:00 # ==================================================== ## =================================================== # Set your OpenBSD version here, you can choose # between "current" and "stable", if you choose # "stable" you have to choose the "stable" version. # eg: OPENBSD_3_4 OBSDVER=OPENBSD_3_4 #OBSDVER=current ## =================================================== # Do not touch anything under this line! :) ## =================================================== # Download anoncvs server list from here URL=http://www.openbsd.org/anoncvs.html get_cvs() { # get the mirror list and then regexp echo Getting list form $URL ... lynx -dump -nolist $URL |grep \ "+ CVSROOT" | cut -d "@" -f 2 | cut -d ":" -f 1 > anoncvs.list # write in a file echo Pinging hosts ... it may takes a while for i in $(cat anoncvs.list); do ping -c 1 $i |grep -e "---" -e "time" |cut -d "=" -f 4 \ >> cvs.results; done; echo ... done echo "" echo Results in "cvs.results" file. echo Please choose one and set CVSROOT variable. Then run again this script. echo \(eg: \# CVSROOT=anoncvs@openbsd.yahoo.com:/cvs\; export CVSROOT\) exit } # ============================ # main() # ============================ if [ $(id -u) != 0 ]; then echo You should be root to run those tasks. exit fi if [ -x $OBSDVER ]; then echo You MUST set your OpenBSD version. exit fi start() { if [ -x != $CVSROOT ]; then echo CVSROOT set to $CVSROOT. echo OpenBSD version set to $OBSDVER. echo "" else echo Empty CVSROOT variable. get_cvs fi echo You want to: echo \(G\)et ports echo \(U\)pgrade ports echo Get \(S\)ources echo Upgrade S\(o\)urces echo Get \(K\)ernel Sources read x case "$x" in U|u) echo Now upgrading ports from $CVSROOT ... if [ $OBSDVER == "current" ]; then # current upgrade ports cd /usr; cvs -q up -Pd ports && exit else # stable upgrade ports cd /usr; cvs -q up -r$OBSDVER ports && exit fi ;; G|g) echo Now getting ports from $CVSROOT ... if [ $OBSDVER == "current" ]; then # current get ports cd /usr; cvs -q up -Pd ports && exit else # stable get ports cd /usr; cvs -q get -r$OBSDVER -P ports && exit fi ;; S|s) echo Now getting sources from $CVSROOT ... if [ $OBSDVER == "current" ]; then # current get src cd /usr; cvs -q get -P src && exit else # stable get src cd /usr; cvs -q get -r$OBSDVER -P src && exit fi ;; o|O) echo Now upgrading sources from $CVSROOT ... if [ $OBSDVER == "current" ]; then # current update src cd /usr/src; cvs -q up -Pd && exit else # stable upgrade src cd /usr/src; cvs -q up -r$OBSDVER -Pd && exit fi ;; K|k) if [ $OBSDVER == "current" ]; then echo No package is available for current kernel, echo just upgrade your sources. exit else KRNVER=$(echo $OBSDVER |cut -c 9-12 |sed "s/_/./g") fi mkdir /usr/src >/dev/null 2>&1 cd /usr/src; # change to suit your needs FTP=ftp://ftp.openbsd.org/pub/OpenBSD/$KRNVER/sys.tar.gz echo Getting Kernel Sources from $FTP ftp $FTP && if [ $? == 0 ]; then tar xzvf sys.tar.gz && exit else echo FTP error or connection down. echo Check mirror and retry. exit fi ;; esac } start # ==================================== # EOF # ==================================== # different server # cvs -d $CVSROOT -q up -Pd