Home | History | Annotate | Line # | Download | only in examples
      1 #!/bin/sh
      2 
      3 #	$NetBSD: cvs.sh.sh,v 1.4 2017/05/09 23:26:49 kamil Exp $
      4 
      5 # ensure that HOME is set for pserver modes
      6 UID=`id -u`
      7 export HOME=`awk -F: '$3=='"$UID"'{print$6}' /etc/passwd`
      8 # supplement path to include ssh and cvs
      9 export PATH=/usr/pkg/bin:$PATH
     10 # use ssh instead of rsh for cvs connections
     11 export CVS_RSH=ssh
     12 
     13 case $1 in
     14 	netbsd)
     15 		export CVSROOT="anoncvs (at] anoncvs.NetBSD.org:/cvsroot"
     16 		shift
     17 		;;
     18 	openbsd)
     19 		export CVSROOT="anoncvs (at] anoncvs.usa.openbsd.org:/cvs"
     20 		shift
     21 		;;
     22 	*)
     23 		echo "configuration not supported"
     24 		exit 0
     25 esac
     26 
     27 for file; do
     28 	if ( echo $file | egrep -qi '(.*),(-r)?([0-9\.]+|[-_a-z0-9]+)$' ); then
     29 		rev="-r`expr "$file" : '.*,\(.*\)' | sed 's/^-r//'`"
     30 		file="`expr "$file" : '\(.*\),.*'`"
     31 	else
     32 		rev=""
     33 	fi
     34 	cvs co -p $rev $file
     35 done
     36