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