a4031bcaf37bb5176674de6da9727a69f456c1dd
[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 export FEISTY_MEOW_DIR="$(pwd)"
19 popd &>/dev/null
20
21 export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_DIR/scripts"
22
23 # FEISTY_MEOW_GENERATED is where the generated files feisty_meow uses are located.
24 export FEISTY_MEOW_GENERATED="$HOME/.zz_auto_gen"
25 if [ ! -d "$FEISTY_MEOW_GENERATED" ]; then
26   mkdir "$FEISTY_MEOW_GENERATED"
27 fi
28 # make toast out of generated files right away, but leave any custom scripts.
29 find "$FEISTY_MEOW_GENERATED" -maxdepth 1 -type f -exec rm -f "{}" ';' &>/dev/null
30 if [ ! -d "$FEISTY_MEOW_GENERATED/custom" ]; then
31   mkdir "$FEISTY_MEOW_GENERATED/custom"
32 fi
33
34 # just a variable we use in here to refer to the generated variables file.
35 GENERATED_FEISTY_MEOW_VARIABLES="$FEISTY_MEOW_GENERATED/fmc_variables.sh"
36 # create the alias file as totally blank.
37 echo -n >"$GENERATED_FEISTY_MEOW_VARIABLES"
38 for i in FEISTY_MEOW_DIR FEISTY_MEOW_SCRIPTS FEISTY_MEOW_GENERATED; do
39   echo "export $i=${!i}" >>"$GENERATED_FEISTY_MEOW_VARIABLES"
40 done
41
42 # load our variables so we get a useful PERLLIB variable.
43 source "$FEISTY_MEOW_SCRIPTS/core/variables.sh"
44
45 # create our common aliases.
46 perl "$FEISTY_MEOW_SCRIPTS/core/generate_aliases.pl"
47
48 if [ ! -z "$SHELL_DEBUG" ]; then
49   echo established these variables for feisty_meow assets:
50   echo ==============
51   cat "$GENERATED_FEISTY_MEOW_VARIABLES"
52   echo ==============
53 fi
54