more recent changes than were available on zooty at the time of initial checkin.
[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 ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && \pwd )"
13 YETI_CORE_SCRIPTS_DIR="$(echo "$ORIGINATING_FOLDER" | tr '\\\\' '/' )"
14 THIS_TOOL_NAME="$(basename "$0")"
15
16 ## check this scripts directory; do we find this script there?
17 #pushd "/" &>/dev/null  # jump to root so relative paths have to fail.
18 #if [ ! -f "$YETI_CORE_SCRIPTS_DIR/$THIS_TOOL_NAME" ]; then
19 #  echo "This script must be run using its full pathname.  This enables the script to"
20 #  echo "locate the proper folders.  Please try again with the full path, e.g.:"
21 #  echo "    bash /home/fred/codeplex/$THIS_TOOL_NAME"
22 #  exit 1
23 #fi
24 #popd &>/dev/null
25
26 # set up the yeti dir.
27 pushd "$YETI_CORE_SCRIPTS_DIR/../.." &>/dev/null
28 export YETI_DIR="$(pwd)"
29 popd &>/dev/null
30 #echo yeti is $YETI_DIR
31
32 export YETI_SCRIPTS="$YETI_DIR/scripts"
33 export SHELLDIR="$YETI_SCRIPTS"
34
35 # GENERADIR is where the generated files yeti uses are located.
36 export GENERADIR="$HOME/.zz_auto_gen"
37 if [ ! -z "$WINDIR" -o ! -z "$windir" ]; then
38   # assume they are using windoze.
39   export GENERADIR="$TMP/zz_auto_gen"
40 fi
41 if [ ! -d "$GENERADIR" ]; then
42   mkdir "$GENERADIR"
43 fi
44
45 YETIVARS="$GENERADIR/yeti_variables.sh"
46 echo >"$YETIVARS"
47 for i in YETI_DIR YETI_SCRIPTS SHELLDIR GENERADIR; do
48   echo "export $i=${!i}" >>"$YETIVARS"
49 done
50
51 # create our common aliases.
52 perl "$YETI_SCRIPTS/core/generate_aliases.pl"
53
54 echo -e '\n\n'
55 echo Established this set of variables to describe how to find yeti assets:
56 cat "$YETIVARS"
57 echo -e '\n'
58