From 8d1f8f686d8b7f306d9f8ed36561f553c609acc0 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 21 Sep 2022 17:07:02 -0400 Subject: [PATCH] tweaks to startup got the loadfm script to work without too many assumptions. --- infobase/feisty_inits/dot.bashrc-root | 7 +++--- scripts/core/common.alias | 8 +++--- scripts/core/loadfm.sh | 35 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100755 scripts/core/loadfm.sh diff --git a/infobase/feisty_inits/dot.bashrc-root b/infobase/feisty_inits/dot.bashrc-root index 944ed1ad..ddc131a8 100644 --- a/infobase/feisty_inits/dot.bashrc-root +++ b/infobase/feisty_inits/dot.bashrc-root @@ -27,10 +27,9 @@ export HISTFILESIZE=8000000 # system-wide install (will be fixed by connect_feisty_meow script): export FEISTY_MEOW_APEX="/opt/feistymeow.org/feisty_meow" -# the "fredme" macro enables the feisty_meow environment. -alias fredme='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"' -# synonym for fredme which makes more sense to most people. -alias feistyme='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"' +# the "gofeisty" macro enables the feisty_meow environment. this can be used +# after logging in, and avoids loading the feisty meow environment automatically. +alias gofeisty='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"' # if not commented out, then feisty meow will run all the unit tests during builds. #export RUN_ALL_TESTS=true diff --git a/scripts/core/common.alias b/scripts/core/common.alias index f2c3b437..430b14ae 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -153,10 +153,10 @@ define_yeti_alias why='echo We all wonder what the point of the universe is at t ############## -# remove the "fredization" or "feistymeowization" macros if they're defined, -# which reduces the chance of loading the shell environment twice for users -# like root that don't load feisty meow automatically. -unalias fredme feistyme &>/dev/null +# remove the "feistymeowization" macro if defined, which reduces the chance of +# loading the shell environment twice for users like root who don't load +# feisty meow automatically. +unalias gofeisty &>/dev/null ############## diff --git a/scripts/core/loadfm.sh b/scripts/core/loadfm.sh new file mode 100755 index 00000000..8911b461 --- /dev/null +++ b/scripts/core/loadfm.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# this is a simplified feisty meow environment loader that starts +# a subshell within which the environment is available. exiting +# one time gets back to the shell that ran this script. (this script +# is designed to be executed, not sourced.) + +# Author: Chris Koeritz + +ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && /bin/pwd )" +export CORE_SCRIPTS_DIR="$(echo "$ORIGINATING_FOLDER" | tr '\\\\' '/' )" +echo core scripts dir is $CORE_SCRIPTS_DIR + +THIS_TOOL_NAME="$(basename "$0")" + +pushd "$CORE_SCRIPTS_DIR/../.." &>/dev/null +export FEISTY_MEOW_APEX="$(/bin/pwd)" +echo feisty apex is now FEISTY_MEOW_APEX=$FEISTY_MEOW_APEX + +#hmmm: actually this should run the reconfigure script first! +# then we would be semi-bulletproof and wouldn't actually have +# to make users run that as first step? + +bash --init-file <(echo "\ +echo "subshell sees feisty meow apex as $FEISTY_MEOW_APEX"; \ +bash "$CORE_SCRIPTS_DIR/reconfigure_feisty_meow.sh"; \ +if [ $? -ne 0 ]; then echo "error--reconfiguring feisty meow environment failed."; fi; \ +source "$CORE_SCRIPTS_DIR/launch_feisty_meow.sh"; \ +if [ $? -ne 0 ]; then echo "error--launching feisty meow environment failed."; fi; \ +") + +popd &> /dev/null + +#### + -- 2.34.1