updated to get closer to building using cygwin, which is difficult because
[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 the feisty meow scripts.
7 #
8 # Note: this does not yet ensure that the profile is executed on shell
9 # startup.  that can be added manually by editing your .bashrc file.
10 # read the examples/feisty_meow_startup/bashrc_user file for more details.
11
12 ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && \pwd )"
13 CORE_SCRIPTS_DIR="$(echo "$ORIGINATING_FOLDER" | tr '\\\\' '/' )"
14 THIS_TOOL_NAME="$(basename "$0")"
15
16 # set up the feisty_meow dir.
17 pushd "$CORE_SCRIPTS_DIR/../.." &>/dev/null
18 source "$CORE_SCRIPTS_DIR/functions.sh"
19 export FEISTY_MEOW_DIR="$(pwd)"
20 popd &>/dev/null
21
22 export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_DIR/scripts"
23
24 # FEISTY_MEOW_GENERATED is where the generated files feisty_meow uses are located.
25 export FEISTY_MEOW_GENERATED="$HOME/.zz_auto_gen"
26 if [ ! -d "$FEISTY_MEOW_GENERATED" ]; then
27   mkdir "$FEISTY_MEOW_GENERATED"
28 fi
29 # make toast out of generated files right away, but leave any custom scripts.
30 find "$FEISTY_MEOW_GENERATED" -maxdepth 1 -type f -exec rm -f "{}" ';' &>/dev/null
31 if [ ! -d "$FEISTY_MEOW_GENERATED/custom" ]; then
32   mkdir "$FEISTY_MEOW_GENERATED/custom"
33 fi
34
35 # just a variable we use in here to refer to the generated variables file.
36 GENERATED_FEISTY_MEOW_VARIABLES="$FEISTY_MEOW_GENERATED/fmc_variables.sh"
37 # create the alias file as totally blank.
38 echo -n >"$GENERATED_FEISTY_MEOW_VARIABLES"
39 for i in FEISTY_MEOW_DIR FEISTY_MEOW_SCRIPTS FEISTY_MEOW_GENERATED; do
40   echo "export $i=${!i}" >>"$GENERATED_FEISTY_MEOW_VARIABLES"
41 done
42
43 # load our variables so we get a useful PERLLIB variable.
44 source "$FEISTY_MEOW_SCRIPTS/core/variables.sh"
45
46 # create our common aliases.
47 perl "$FEISTY_MEOW_SCRIPTS/core/generate_aliases.pl"
48
49 if [ ! -z "$SHELL_DEBUG" ]; then
50   echo established these variables for feisty_meow assets:
51   echo ==============
52   cat "$GENERATED_FEISTY_MEOW_VARIABLES"
53   echo ==============
54 fi
55