Merge branch 'dev' of feistymeow.org:feisty_meow into dev
[feisty_meow.git] / scripts / core / launch_feisty_meow.sh
index 26ad78e2d1d5d7101a69f70972aeaa4d89efe5b1..3a9344ef3c3b1b66f483f406cf4c2fc992acce3a 100644 (file)
@@ -44,13 +44,37 @@ if [ ! -d "$FEISTY_MEOW_APEX" ]; then
 The feisty meow configuration is damaged somehow.  Please change to the
 directory where it is stored, e.g.:
 
-    cd /opt/feistymeow.org/feisty_meow
+  cd /opt/feistymeow.org/feisty_meow
 
-and execute this command:
+and run this command (the whole unwieldy multiple line chunk inside the bars):
 
-    export FEISTY_MEOW_APEX=\"\$(pwd)\"; export FEISTY_MEOW_SCRIPTS=\"\$(pwd)/scripts\"; bash scripts/core/reconfigure_feisty_meow.sh && exec bash -i -c \"source \$(pwd)/core/launch_feisty_meow.sh; bash\"
+
+##############
+  exec bash -i 3<<EOF 4<&0 <&3
+    echo -e '\n\n^^^ errors above here indicate potential problems in .bashrc ^^^';
+    export FEISTY_MEOW_APEX=\"\$(pwd)\"; export FEISTY_MEOW_SCRIPTS=\$FEISTY_MEOW_APEX/scripts;
+    export FEISTY_MEOW_SHOW_LAUNCH_GREETING=yes;
+    /bin/bash \$(pwd)/scripts/core/reconfigure_feisty_meow.sh;
+    source \$(pwd)/scripts/core/launch_feisty_meow.sh; exec 3>&- <&4
+EOF
+##############
+
+
+This code snippet assumes that the .bashrc file could still need editing to
+fix an erroneous FEISTY_MEOW_APEX variable, so we skip it above when bash
+runs.  Check \$HOME/.bashrc to see if a change there will fix the problem.
 
 "
+else
+  # apex is good, so let's make the scripts good too.
+  if [ -z "$FEISTY_MEOW_SCRIPTS" -o ! -d "$FEISTY_MEOW_SCRIPTS" ]; then
+    export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_APEX/scripts"
+  fi
+  # check again to test our belief system...
+  if [ ! -d "$FEISTY_MEOW_SCRIPTS" ]; then
+    unset NO_REPAIRS_NEEDED
+    echo -e "The feisty meow scripts cannot be found under the current top:\n  FEISTY_MEOW_APEX=$FEISTY_MEOW_APEX"
+  fi
 fi
 
 if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
@@ -98,15 +122,20 @@ if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
     fi
   
     ##############
+
+echo POINT A
   
     if [ -z "$ERROR_OCCURRED" ]; then
-  
+
+echo POINT B
       # pull in our generated variables that are the minimal set we need to find
       # the rest of our resources.
       source "$FEISTY_MEOW_VARIABLES_LOADING_FILE"
   
+echo POINT C
       # Set up the temporary directory.
       source "$FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh"
+echo POINT D
     fi
   
   fi
@@ -115,11 +144,14 @@ if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
 
   if [ -z "$ERROR_OCCURRED" ]; then
 
+echo POINT E
+
     # load the larger body of standard feisty meow variables into the environment.
     # we actually want this to always run also; it will decide what variables need
     # to be set again.
     source "$FEISTY_MEOW_SCRIPTS/core/variables.sh"
 
+echo POINT F
     ##############
 
     # include helpful functions.  we do this every time rather than making it part
@@ -127,11 +159,14 @@ if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
     # sub-shells in bash.
     source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
 
+echo POINT G
     # load some helper methods for the terminal which we'll use below.
     source "$FEISTY_MEOW_SCRIPTS/tty/terminal_titler.sh"
 
+echo POINT H
     ##############
 
+#hmmm: abstract this to a twiddle shell options method.
     # check hash table before searching path.
     shopt -s checkhash
     # don't check path for sourced files.
@@ -144,6 +179,7 @@ if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
     shopt -s checkwinsize
 
     ##############
+echo POINT I
 
     # make history writes immediate to avoid losing history if bash is zapped.
     echo $PROMPT_COMMAND | grep -q history
@@ -158,15 +194,19 @@ if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
 
     if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo "heavyweight init begins..."; fi
 
+echo POINT J
     # set up the aliases for the shell, but only if they are not already set.
     type CORE_ALIASES_LOADED &>/dev/null
     if [ $? -ne 0 ]; then
       if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then
         echo "the aliases were missing, now they are being added..."
       fi
+echo HEEE HAHAHAHAHA
       source "$FEISTY_MEOW_LOADING_DOCK/fmc_core_and_custom_aliases.sh"
+echo HOOOOEY
     fi
 
+echo POINT K
     #echo before the new labelling, terminal titles have:
     #show_terminal_titles
 
@@ -182,5 +222,18 @@ if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
 
   fi  # no error occurred.
 
+  if [ ! -z "$FEISTY_MEOW_SHOW_LAUNCH_GREETING" ]; then
+    echo
+    echo
+    echo "welcome to the feisty meow zone of peace, one of many refuges in the uncountably"
+    echo "infinite multiverses that are hypothetically possible."
+    echo
+    echo
+    unset FEISTY_MEOW_SHOW_LAUNCH_GREETING
+  fi
+
+  # load the last bits we do here.
+  source "$FEISTY_MEOW_LOADING_DOCK/fmc_ending_sentinel.sh"
+
 fi # "$NO_REPAIRS_NEEDED" was == "true"