92c3ee55e73039c79fd5acba4be286b70b485535
[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 #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 $i/xsede/code/cak0l/trunk ; do
43       if [ ! -d $j ]; then
44 #        echo no directory called $j exists
45         continue
46       fi
47
48       pushd $j &>/dev/null
49       echo -n "retrieving '$j'...  "
50       do_update $j
51       popd &>/dev/null
52     done
53   done
54 }
55
56 rm -f "$TMPO_CHK"
57
58 # perform the checkouts as appropriate per OS.
59 if [ "$OS" != "Windows_NT" ]; then
60   checkout_list $HOME 2>&1 | tee -a "$TMPO_CHK"
61 else
62   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"
63 fi
64
65 less $TMPO_CHK
66
67 # we now regenerate the scripts after getme, to ensure it's done automatically.
68 bash "$FEISTY_MEOW_SCRIPTS/core/bootstrap_shells.sh"
69 perl "$FEISTY_MEOW_SCRIPTS/core/generate_aliases.pl"
70 echo
71 nechung
72