From bd2cc8375efd80771088161ba31e41a521523c26 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Fri, 10 Nov 2017 22:28:24 -0500 Subject: [PATCH] refurbishing for more auto-repair launcher script cannot auto-locate itself, since it's a sourced script. so we had to try something more drastic. --- scripts/core/generate_aliases.pl | 2 ++ scripts/core/launch_feisty_meow.sh | 24 ++++++++++++++++++------ scripts/core/reconfigure_feisty_meow.sh | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/core/generate_aliases.pl b/scripts/core/generate_aliases.pl index a9c40435..4ed01fb7 100644 --- a/scripts/core/generate_aliases.pl +++ b/scripts/core/generate_aliases.pl @@ -94,11 +94,13 @@ sub rebuild_script_aliases { } if (length($DEBUG_FEISTY_MEOW)) { print "using these alias files:\n"; +print "HEY IS THIS PROBLEM CHILD?\n"; foreach $i (@ALIAS_DEFINITION_FILES) { local $base_of_dir = &basename(&dirname($i)); local $basename = &basename($i); print " $base_of_dir/$basename\n"; } +print "WAS PROBLEM CHILD ABOVE HERE?\n"; } # write the aliases for sh and bash scripts. diff --git a/scripts/core/launch_feisty_meow.sh b/scripts/core/launch_feisty_meow.sh index 496786a7..80226899 100644 --- a/scripts/core/launch_feisty_meow.sh +++ b/scripts/core/launch_feisty_meow.sh @@ -18,12 +18,24 @@ ############## -ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && /bin/pwd )" -CORE_SCRIPTS_DIR="$(echo "$ORIGINATING_FOLDER" | tr '\\\\' '/' )" -THIS_TOOL_NAME="$(basename "$0")" -# repair some paths that we should always be able to auto-calculate. -export FEISTY_MEOW_SCRIPTS="$( \cd "$CORE_SCRIPTS_DIR/.." && /bin/pwd )" -export FEISTY_MEOW_APEX="$( \cd "$FEISTY_MEOW_SCRIPTS/.." && /bin/pwd )" +# this script cannot handle figuring out where it lives, so approaches that +# get the WORKDIR will fail. this is a consequence of this always being used +# in bash's 'source' directive, which does not pass the script name as +# argument 0. instead, we just check for the bad condition of a malconfigured +# script system and try to repair it. + +# check if any crucial folder is hosed. we will torch the existing config +# to the extent we can. +if [ ! -d "$FEISTY_MEOW_SCRIPTS" -o ! -d "$FEISTY_MEOW_APEX" ]; then + # wipe out the offending variable(s). + unset FEISTY_MEOW_SCRIPTS FEISTY_MEOW_APEX + # clean out any unfortunate wrongness that may exist in our generated areas. + if [ -d "$"FEISTY_MEOW_LOADING_DOCK ]; then \rm -rf "$FEISTY_MEOW_LOADING_DOCK"; fi + if [ -d "$FEISTY_MEOW_GENERATED_STORE" ]; then \rm -rf "$FEISTY_MEOW_GENERATED_STORE"; fi + # also wipe any values from the variables pointing at generated stuff. + unset FEISTY_MEOW_LOADING_DOCK FEISTY_MEOW_GENERATED_STORE + exec "$*" +fi ############## diff --git a/scripts/core/reconfigure_feisty_meow.sh b/scripts/core/reconfigure_feisty_meow.sh index ffef7270..b6421224 100644 --- a/scripts/core/reconfigure_feisty_meow.sh +++ b/scripts/core/reconfigure_feisty_meow.sh @@ -75,7 +75,7 @@ PERLLIB=$PERLLIB PERL5LIB=$PERLLIB perl "$FEISTY_MEOW_SCRIPTS/core/generate_alia #echo after the generate aliases, perllib is $PERLLIB if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then - echo established these variables for feisty_meow assets: + echo this is the variable config file for feisty_meow assets: echo ============== cat "$FEISTY_MEOW_VARIABLES_LOADING_FILE" echo ============== -- 2.34.1