File: get-config-dir-cvs

package info (click to toggle)
fai 6.5.4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,076 kB
  • sloc: sh: 6,720; perl: 5,626; makefile: 138
file content (45 lines) | stat: -rwxr-xr-x 1,334 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash

# (c) 2002-2006 Henning Glawe <glaweh@debian.org>

### BEGIN SUBROUTINE INFO
# Provides-Var:
# Requires-Var:    $FAI_CONFIG_SRC $FAI $LOGDIR
# Suggests-Var:
# Short-Description: get $FAI from a cvs repository.
### END SUBROUTINE INFO

# matched string: "cvs[+ssh]://user@host/path/to/cvsroot module[=tag]"
# dir contains user@host/path/to/cvsroot
protocol=$(expr match "$FAI_CONFIG_SRC" '\([^:]*\)://')
dir=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([^[:space:]]\+\)[[:space:]]\+')
module=$(expr match "$FAI_CONFIG_SRC" '[^:]*://.*[[:space:]]\+\([^=]*\)')
tag=$(expr match "$FAI_CONFIG_SRC" '[^=]*=\([^=]*\)')

case $protocol in
        cvs+ssh)
                export CVS_RSH=ssh
                export CVSROOT=":ext:$dir"
                ;;
        cvs)
                export CVSROOT=":pserver:$dir"
                ;;
        *)
                echo "get-config-dir-cvs: protocol $protocol not implemented"
                exit 1
                ;;
esac

[ -n "$tag" ] && tag="-r $tag"

if [ -d "$FAI/CVS" ] ; then
   echo "Updating CVS in $FAI"
   cd $FAI
   cvs -q up -P $tag -d -C > $LOGDIR/getconf.log
   task_error 881 $?
else
   echo "Checking out CVS"
   cd ${FAI%/*}     # cd to dirname $FAI
   cvs -q co -P -d ${FAI##*/} $tag $module > $LOGDIR/getconf.log   # -d uses basename of $FAI
   task_error 882 $?
fi