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