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