Debian Codegraph @

lib/get-config-dir-cvs

raw
1 #!/bin/bash
2
3 # (c) 2002-2006 Henning Glawe <[email protected]>
4
5 ### BEGIN SUBROUTINE INFO
6 # Provides-Var:
7 # Requires-Var: $FAI_CONFIG_SRC $FAI $LOGDIR
8 # Suggests-Var:
9 # Short-Description: get $FAI from a cvs repository.
10 ### END SUBROUTINE INFO
11
12 # matched string: "cvs[+ssh]://user@host/path/to/cvsroot module[=tag]"
13 # dir contains user@host/path/to/cvsroot
14 protocol=$(expr match "$FAI_CONFIG_SRC" '\([^:]*\)://')
15 dir=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([^[:space:]]\+\)[[:space:]]\+')
16 module=$(expr match "$FAI_CONFIG_SRC" '[^:]*://.*[[:space:]]\+\([^=]*\)')
17 tag=$(expr match "$FAI_CONFIG_SRC" '[^=]*=\([^=]*\)')
18
19 case $protocol in
20 cvs+ssh)
21 export CVS_RSH=ssh
22 export CVSROOT=":ext:$dir"
23 ;;
24 cvs)
25 export CVSROOT=":pserver:$dir"
26 ;;
27 *)
28 echo "get-config-dir-cvs: protocol $protocol not implemented"
29 exit 1
30 ;;
31 esac
32
33 [ -n "$tag" ] && tag="-r $tag"
34
35 if [ -d "$FAI/CVS" ] ; then
36 echo "Updating CVS in $FAI"
37 cd $FAI
38 cvs -q up -P $tag -d -C > $LOGDIR/getconf.log
39 task_error 881 $?
40 else
41 echo "Checking out CVS"
42 cd ${FAI%/*} # cd to dirname $FAI
43 cvs -q co -P -d ${FAI##*/} $tag $module > $LOGDIR/getconf.log # -d uses basename of $FAI
44 task_error 882 $?
45 fi