first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / scripts / core / bootstrap_shells.sh
1 #!/bin/bash
2 #
3 # bootstrap_shells:
4 #
5 # This script creates the directory for auto-generated scripts and gets
6 # the current user's account ready to use YETI.
7 #
8 # Note: this does not yet ensure that the YETI profile is executed on
9 # shell startup.  that can be added manually by editing your .bashrc file.
10 # read the examples/bashrc_user file for more details.
11
12 YETI_CORE_SCRIPTS_DIR="$(dirname "$0" | tr '\\\\' '/' )"
13 THIS_TOOL_NAME="$(basename "$0")"
14
15 # check this scripts directory; do we find this script there?
16 pushd "/" &>/dev/null  # jump to root so relative paths have to fail.
17 if [ ! -f "$YETI_CORE_SCRIPTS_DIR/$THIS_TOOL_NAME" ]; then
18   echo "This script must be run using its full pathname.  This enables the script to"
19   echo "locate the proper folders.  Please try again with the full path, e.g.:"
20   echo "    bash /home/fred/codeplex/$THIS_TOOL_NAME"
21   exit 1
22 fi
23 popd &>/dev/null
24
25 # set up the yeti dir if it's not already defined.
26 pushd "$YETI_CORE_SCRIPTS_DIR/../.." &>/dev/null
27 export YETI_DIR="$(pwd)"
28 popd &>/dev/null
29 #echo yeti is $YETI_DIR
30
31 export YETI_SCRIPTS="$YETI_DIR/scripts"
32 export SHELLDIR="$YETI_SCRIPTS"
33
34 # GENERADIR is where the generated files yeti uses are located.
35 export GENERADIR="$HOME/.zz_auto_gen"
36 if [ ! -z "$WINDIR" -o ! -z "$windir" ]; then
37   # assume they are using windoze.
38   export GENERADIR="$TMP/zz_auto_gen"
39 fi
40 if [ ! -d "$GENERADIR" ]; then
41   mkdir "$GENERADIR"
42 fi
43
44 YETIVARS="$GENERADIR/yeti_variables.sh"
45 echo >"$YETIVARS"
46 for i in YETI_DIR YETI_SCRIPTS SHELLDIR GENERADIR; do
47   echo "export $i=${!i}" >>"$YETIVARS"
48 done
49
50 # create our common aliases.
51 perl "$YETI_SCRIPTS/core/generate_aliases.pl"
52
53 echo -e '\n\n'
54 echo Established this set of variables to describe how to find yeti assets:
55 cat "$YETIVARS"
56 echo -e '\n'
57