moved the top-level and probably most important feisty meow variable from the seeming...
[feisty_meow.git] / scripts / core / bootstrap_shells.sh
index 5ce180c199664cff299c494c59f96c3b01883933..0e643254b3bd5bc46703f9ce08a39e0f1a07fde1 100644 (file)
@@ -3,55 +3,68 @@
 # bootstrap_shells:
 #
 # This script creates the directory for auto-generated scripts and gets
-# the current user's account ready to use YETI.
+# the current user's account ready to use the feisty meow scripts.
 #
-# Note: this does not yet ensure that the YETI profile is executed on
-# shell startup.  that can be added manually by editing your .bashrc file.
-# read the examples/bashrc_user file for more details.
+# Note: this does not yet ensure that the profile is executed on shell
+# startup.  that can be added manually by editing your .bashrc file.
+# read the examples/feisty_meow_startup/bashrc_user file for more details.
 
-ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && \pwd )"
-YETI_CORE_SCRIPTS_DIR="$(echo "$ORIGINATING_FOLDER" | tr '\\\\' '/' )"
+ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && /bin/pwd )"
+CORE_SCRIPTS_DIR="$(echo "$ORIGINATING_FOLDER" | tr '\\\\' '/' )"
 THIS_TOOL_NAME="$(basename "$0")"
 
-## check this scripts directory; do we find this script there?
-#pushd "/" &>/dev/null  # jump to root so relative paths have to fail.
-#if [ ! -f "$YETI_CORE_SCRIPTS_DIR/$THIS_TOOL_NAME" ]; then
-#  echo "This script must be run using its full pathname.  This enables the script to"
-#  echo "locate the proper folders.  Please try again with the full path, e.g.:"
-#  echo "    bash /home/fred/codeplex/$THIS_TOOL_NAME"
-#  exit 1
-#fi
-#popd &>/dev/null
-
 # set up the feisty_meow dir.
-pushd "$YETI_CORE_SCRIPTS_DIR/../.." &>/dev/null
-export FEISTY_MEOW_DIR="$(pwd)"
+pushd "$CORE_SCRIPTS_DIR/../.." &>/dev/null
+source "$CORE_SCRIPTS_DIR/functions.sh"
+
+#echo originating folder is $ORIGINATING_FOLDER
+export FEISTY_MEOW_APEX="$(/bin/pwd)"
+#echo feisty now is FEISTY_MEOW_APEX=$FEISTY_MEOW_APEX
+
+# repetitive bit stolen from variables.  should make a file out of this somehow.
+IS_DOS=$(uname | grep -i ming)
+if [ -z "$IS_DOS" ]; then IS_DOS=$(uname | grep -i cygwin); fi
+# now if we're stuck in DOS, then fix the feisty meow variable name.
+if [ ! -z "$IS_DOS" ]; then
+  FEISTY_MEOW_APEX="$(cmd /c chdir | tr A-Z a-z | sed -e 's/\\/\//g')"
+echo feisty meow dos is: $FEISTY_MEOW_APEX
+  FEISTY_MEOW_APEX="$(dos_to_unix_path "$FEISTY_MEOW_APEX")"
+echo new feisty meow fixed dir is: $FEISTY_MEOW_APEX
+fi
+
 popd &>/dev/null
-#echo feisty_meow is $FEISTY_MEOW_DIR
 
-export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_DIR/scripts"
+export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_APEX/scripts"
 
-# FEISTY_MEOW_GENERATED is where the generated files feisty_meow uses are located.
-export FEISTY_MEOW_GENERATED="$HOME/.zz_auto_gen"
-if [ ! -z "$WINDIR" -o ! -z "$windir" ]; then
-  # assume they are using windoze.
-  export FEISTY_MEOW_GENERATED="$TMP/zz_auto_gen"
+# FEISTY_MEOW_LOADING_DOCK is where the generated files feisty_meow uses are located.
+export FEISTY_MEOW_LOADING_DOCK="$HOME/.zz_feisty_loading"
+if [ ! -d "$FEISTY_MEOW_LOADING_DOCK" ]; then
+  mkdir -p "$FEISTY_MEOW_LOADING_DOCK"
 fi
-if [ ! -d "$FEISTY_MEOW_GENERATED" ]; then
-  mkdir "$FEISTY_MEOW_GENERATED"
+# make toast out of generated files right away, but leave any custom scripts.
+find "$FEISTY_MEOW_LOADING_DOCK" -maxdepth 1 -type f -exec rm -f "{}" ';' &>/dev/null
+if [ ! -d "$FEISTY_MEOW_LOADING_DOCK/custom" ]; then
+  mkdir "$FEISTY_MEOW_LOADING_DOCK/custom"
 fi
 
-GENERATED_FEISTY_MEOW_VARIABLES="$FEISTY_MEOW_GENERATED/feisty_meow_variables.sh"
-echo >"$GENERATED_FEISTY_MEOW_VARIABLES"
-for i in FEISTY_MEOW_DIR FEISTY_MEOW_SCRIPTS FEISTY_MEOW_GENERATED; do
-  echo "export $i=${!i}" >>"$GENERATED_FEISTY_MEOW_VARIABLES"
+# just a variable we use in here to refer to the generated variables file.
+FEISTY_MEOW_VARIABLES_LOADING_FILE="$FEISTY_MEOW_LOADING_DOCK/fmc_variables.sh"
+# create the alias file as totally blank.
+echo -n >"$FEISTY_MEOW_VARIABLES_LOADING_FILE"
+for i in FEISTY_MEOW_APEX FEISTY_MEOW_SCRIPTS FEISTY_MEOW_LOADING_DOCK; do
+  echo "export $i=${!i}" >>"$FEISTY_MEOW_VARIABLES_LOADING_FILE"
 done
 
+# load our variables so we can run our perl scripts successfully.
+source "$FEISTY_MEOW_SCRIPTS/core/variables.sh"
+
 # create our common aliases.
 perl "$FEISTY_MEOW_SCRIPTS/core/generate_aliases.pl"
 
-echo ==========================================
-echo Established this set of variables to describe how to find feisty_meow assets:
-cat "$GENERATED_FEISTY_MEOW_VARIABLES"
-echo ==========================================
+if [ ! -z "$SHELL_DEBUG" ]; then
+  echo established these variables for feisty_meow assets:
+  echo ==============
+  cat "$FEISTY_MEOW_VARIABLES_LOADING_FILE"
+  echo ==============
+fi