taking out code bases for xsede since this gets confusing.
[feisty_meow.git] / scripts / rev_control / getme.sh
1 #!/bin/bash
2
3 # gets all of fred's revision control folders out.
4
5 source "$SHELLDIR/rev_control/rev_control.sh"
6
7 if [ "$(pwd)" != "$TMP" ]; then
8 #  echo "Moving to the TMP directory to avoid file access conflicts..."
9   new_name="$TMP/zz_$(basename $0)"
10   cp -f "$0" "$new_name"
11   if [ $? -ne 0 ]; then
12     echo "failed to copy this script up to the TMP directory.  exploit attempted?"
13     exit 1
14   fi
15   cd "$TMP"
16   chmod a+x "$new_name"
17   exec "$new_name"
18 fi
19
20 export TMPO_CHK=$TMP/zz_chk.log
21
22 # selects the checkout method based on where we are (the host the script runs on).
23 function do_update()
24 {
25   directory="$1"; shift
26
27   if [ -d "CVS" ]; then
28     cvs co -P -kb "$directory"
29   elif [ -d ".svn" ]; then
30     svn update .
31   elif [ -d ".git" ]; then
32     git pull
33   else
34     echo unknown repository for $directory...
35   fi
36 }
37
38 function checkout_list {
39   list=$*
40   for i in $list; do
41 #this list should be part of the configuration file, not part of script.
42     for j in $i/feisty_meow $i/hoople $i/hoople1 $i/hoople2 $i/quartz $i/web $i/yeti $i/xsede/xsede_tests ; do
43 #$i/xsede/code/cak0l/trunk 
44       if [ ! -d $j ]; then
45 #        echo no directory called $j exists
46         continue
47       fi
48
49       pushd $j &>/dev/null
50       echo -n "retrieving '$j'...  "
51       do_update $j
52       popd &>/dev/null
53     done
54   done
55 }
56
57 rm -f "$TMPO_CHK"
58
59 # perform the checkouts as appropriate per OS.
60 if [ "$OS" != "Windows_NT" ]; then
61   checkout_list $HOME 2>&1 | tee -a "$TMPO_CHK"
62 else
63   checkout_list c:/ c:/home d:/ d:/home e:/ e:/home f:/ f:/home g:/ g:/home h:/ h:/home i:/ i:/home 2>&1 | tee -a "$TMPO_CHK"
64 fi
65
66 less $TMPO_CHK
67
68 # we now regenerate the scripts after getme, to ensure it's done automatically.
69 bash "$SHELLDIR/core/bootstrap_shells.sh"
70 perl "$SHELLDIR/core/generate_aliases.pl"
71 echo
72 nechung
73