da9cb3913482df743d2d664f28de0d32a8c1e842
[feisty_meow.git] / scripts / rev_control / getem.sh
1 #!/bin/bash
2
3 # gets any updates for the repository folders present in the REPOSITORY_LIST variable.
4
5 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
6 source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
7
8 ##############
9
10 # trickery to ensure we can always update feisty meow, including this specific
11 # file, even when the operating system has some rude behavior with regard to
12 # file locking (ahem, windoze).  and even more rudeness is that the pwd and
13 # $TMP may not always be in the same form, which causes endless confusion and
14 # badness.  that's why we get the pwd reading for TMP first so we can do an
15 # oranges-to-oranges compare.
16 tmpdir="$(cd $TMP; \pwd)"
17 if [ "$(\pwd)" != "$tmpdir" ]; then
18   if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then
19     echo "moving to the TMP directory to avoid file access conflicts..."
20   fi
21   new_name="$TMP/zz_$(basename $0)"
22   \cp -f "$0" "$new_name"
23   exit_on_error "failed to copy this script up to the TMP directory.  exploit attempted?"
24   pushd "$TMP" &>/dev/null
25   exit_on_error "changing to TMP directory: $TMP"
26   chmod a+x "$new_name"
27   exit_on_error "chmodding of file: $new_name"
28   exec "$new_name"
29   exit_on_error "execing cloned getemscript"
30   popd &>/dev/null
31 fi
32
33 ##############
34
35 export TMPO_CHK=$TMP/zz_chk.log
36
37 rm -f "$TMPO_CHK"
38 exit_on_error "removing file: $TMPO_CHK"
39
40 echo "getting repositories at: $(date)"
41 echo
42
43 # perform the checkouts as appropriate per OS.
44 FULL_LIST="$(dirname $FEISTY_MEOW_APEX) $HOME"
45 if [ "$OS" == "Windows_NT" ]; then
46   FULL_LIST+="c:/ d:/ e:/"
47 fi
48 checkout_list $FULL_LIST 2>&1 | tee -a "$TMPO_CHK"
49 exit_on_error "checking out list: $FULL_LIST"
50
51 ##############
52
53 # regenerate the scripts after getting latest version of feisty meow.
54 regenerate
55
56 ##############
57