updated scheme for locating revision control assets; uses a list (in a
[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 "$FEISTY_MEOW_SCRIPTS/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 update .
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     # turn repo list back into an array.
42     eval "repository_list=( ${REPOSITORY_LIST[*]} )"
43     for j in "${repository_list[@]}"; do
44       # add in the directory for our purposes here.
45       j="$i/$j"
46       if [ ! -d $j ]; then
47         echo no directory called $j exists
48         continue
49       fi
50
51       pushd $j &>/dev/null
52       echo -n "retrieving '$j'...  "
53       do_update $j
54       popd &>/dev/null
55     done
56   done
57 }
58
59 rm -f "$TMPO_CHK"
60
61 # perform the checkouts as appropriate per OS.
62 if [ "$OS" != "Windows_NT" ]; then
63   checkout_list $HOME 2>&1 | tee -a "$TMPO_CHK"
64 else
65   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"
66 fi
67
68 less $TMPO_CHK
69
70 # we now regenerate the scripts after getme, to ensure it's done automatically.
71 bash "$FEISTY_MEOW_SCRIPTS/core/bootstrap_shells.sh"
72 perl "$FEISTY_MEOW_SCRIPTS/core/generate_aliases.pl"
73 echo
74 nechung
75