From: Chris Koeritz Date: Sat, 11 Nov 2017 17:15:38 +0000 (-0500) Subject: Merge branch 'dev' of feistymeow.org:feisty_meow into dev X-Git-Tag: 2.140.97^2~2^2~1 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=086c15677bb5993d61983f5b79c9a31dc1d15e1d;hp=d2bd4ec20ec62b90136eeefa518b91221ecb0ac6;p=feisty_meow.git Merge branch 'dev' of feistymeow.org:feisty_meow into dev --- diff --git a/production/feisty_meow_config.ini b/production/feisty_meow_config.ini index 6415cf1e..ef535c64 100644 --- a/production/feisty_meow_config.ini +++ b/production/feisty_meow_config.ini @@ -3,7 +3,7 @@ # specifies the version of the code that is being constructed here. major=2 minor=140 -revision=92 +revision=96 build=420 # specifies the remainder of the version record info. diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index a66d1939..9dcfce80 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -388,6 +388,7 @@ if [ -z "$skip_all" ]; then echo "The nechung oracle program cannot be found. You may want to consider" echo "rebuilding the feisty meow applications with this command:" echo "bash $FEISTY_MEOW_SCRIPTS/generator/produce_feisty_meow.sh" + echo else $wheres_nechung fi 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 82eb5a7f..241e2a0f 100644 --- a/scripts/core/launch_feisty_meow.sh +++ b/scripts/core/launch_feisty_meow.sh @@ -18,126 +18,208 @@ ############## -# some preconditions we want to establish before loading anything... +# 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. -# make sure that aliases can be used in non-interactive shells. -shopt -s expand_aliases +# we start out thinking things are good. +NO_REPAIRS_NEEDED=true -# patch the user variable if we were launched by one of our cron jobs. -if [ -z "$USER" -a ! -z "$CRONUSER" ]; then - export USER="$CRONUSER" -fi +# check if any crucial folder is hosed. we will torch the existing config +# to the extent we can. +if [ ! -d "$FEISTY_MEOW_APEX" ]; then + # flag some problems. + unset NO_REPAIRS_NEEDED + # 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 + echo " -############## +The feisty meow configuration is damaged somehow. Please change to the +directory where it is stored, e.g.: -export ERROR_OCCURRED= - # there have been no errors to start with, at least. we will set this - # to non-empty if something bad happens. - -if [ -z "$FEISTY_MEOW_LOADING_DOCK" ]; then - # FEISTY_MEOW_LOADING_DOCK is where the generated files are located. - # this is our single entry point we can use without knowing any variables - # yet in the initialization process. - export FEISTY_MEOW_LOADING_DOCK="$HOME/.zz_feisty_loading" -#hmmm: the above is kind of a constant. that's not so great. - - # make sure our main variables are established. - FEISTY_MEOW_VARIABLES_LOADING_FILE="$FEISTY_MEOW_LOADING_DOCK/fmc_variables.sh" - if [ ! -f "$FEISTY_MEOW_VARIABLES_LOADING_FILE" ]; then - echo -e "\ - -The feisty meow scripts need initialization via the bootstrap process. For\n\ -example, if the feisty meow folder lives in '$DEFAULT_FEISTYMEOW_ORG_DIR', then this\n\ -command bootstraps feisty meow:\n\ -\n\ - bash $example_dir/feisty_meow/scripts/core/reconfigure_feisty_meow.sh\n\ -\n\ -\n" - ERROR_OCCURRED=true - fi + cd /opt/feistymeow.org/feisty_meow - ############## +and run this command (the whole unwieldy multiple line chunk inside the bars): - if [ -z "$ERROR_OCCURRED" ]; then - # 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" +############## + exec bash -i 3<&- <&4 +EOF +############## - # Set up the temporary directory. - source "$FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh" - fi +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 [ ! -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 -############## +#; /bin/bash -i --norc --noprofile\" > \$HOME/fm-fix +#; exec /bin/bash -i --norc --noprofile -c 'bash \$HOME/fm-fix ; echo hello ; read line' +#--norc --noprofile +#; source \$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh -if [ -z "$ERROR_OCCURRED" ]; then +if [ "$NO_REPAIRS_NEEDED" == "true" ]; then - # 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" + # we believe it's safe to run through the rest of this script. ############## - # include helpful functions. we do this every time rather than making it part - # of variable initialization, because functions cannot be exported to - # sub-shells in bash. - source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" + # some preconditions we want to establish before loading anything... - # load some helper methods for the terminal which we'll use below. - source "$FEISTY_MEOW_SCRIPTS/tty/terminal_titler.sh" - - ############## + # make sure that aliases can be used in non-interactive shells. + shopt -s expand_aliases - # check hash table before searching path. - shopt -s checkhash - # don't check path for sourced files. - shopt -u sourcepath - # ignore duplicate lines. - HISTCONTROL=ignoredups - # append to the history file. - shopt -s histappend - # automatically update window size if needed. - shopt -s checkwinsize - - ############## - - # make history writes immediate to avoid losing history if bash is zapped. - echo $PROMPT_COMMAND | grep -q history - if [ $? -ne 0 ]; then - # we only change the prompt command if we think it hasn't already been done. - export PROMPT_COMMAND="history -a;$PROMPT_COMMAND" + # patch the user variable if we were launched by one of our cron jobs. + if [ -z "$USER" -a ! -z "$CRONUSER" ]; then + export USER="$CRONUSER" fi ############## - # perform the bulkier parts of the initialization process. + export ERROR_OCCURRED= + # there have been no errors to start with, at least. we will set this + # to non-empty if something bad happens. + + if [ -z "$FEISTY_MEOW_LOADING_DOCK" ]; then + # FEISTY_MEOW_LOADING_DOCK is where the generated files are located. + # this is our single entry point we can use without knowing any variables + # yet in the initialization process. + export FEISTY_MEOW_LOADING_DOCK="$HOME/.zz_feisty_loading" + #hmmm: the above is kind of a constant. that's not so great. - if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo "heavyweight init begins..."; fi + # make sure our main variables are established. + FEISTY_MEOW_VARIABLES_LOADING_FILE="$FEISTY_MEOW_LOADING_DOCK/fmc_variables.sh" + if [ ! -f "$FEISTY_MEOW_VARIABLES_LOADING_FILE" ]; then + echo -e "\ - # 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..." + The feisty meow scripts need initialization via the bootstrap process. For\n\ + example, if the feisty meow folder lives in '$DEFAULT_FEISTYMEOW_ORG_DIR', then this\n\ + command bootstraps feisty meow:\n\ + \n\ + bash $example_dir/feisty_meow/scripts/core/reconfigure_feisty_meow.sh\n\ + \n\ + \n" + ERROR_OCCURRED=true fi - source "$FEISTY_MEOW_LOADING_DOCK/fmc_core_and_custom_aliases.sh" - fi - #echo before the new labelling, terminal titles have: - #show_terminal_titles + ############## - # a minor tickle of the title of the terminal, unless we already have some history. - label_terminal_with_info + if [ -z "$ERROR_OCCURRED" ]; then - if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo "heavyweight init is done."; fi + # 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" + # Set up the temporary directory. + source "$FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh" + fi + + fi + + ############## + if [ -z "$ERROR_OCCURRED" ]; then - # set a sentinel variable to say we loaded the feisty meow environment. - export FEISTY_MEOW_SCRIPTS_LOADED=true + + # 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" + + ############## + + # include helpful functions. we do this every time rather than making it part + # of variable initialization, because functions cannot be exported to + # sub-shells in bash. + source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" + + # load some helper methods for the terminal which we'll use below. + source "$FEISTY_MEOW_SCRIPTS/tty/terminal_titler.sh" + + ############## + + # check hash table before searching path. + shopt -s checkhash + # don't check path for sourced files. + shopt -u sourcepath + # ignore duplicate lines. + HISTCONTROL=ignoredups + # append to the history file. + shopt -s histappend + # automatically update window size if needed. + shopt -s checkwinsize + + ############## + + # make history writes immediate to avoid losing history if bash is zapped. + echo $PROMPT_COMMAND | grep -q history + if [ $? -ne 0 ]; then + # we only change the prompt command if we think it hasn't already been done. + export PROMPT_COMMAND="history -a;$PROMPT_COMMAND" + fi + + ############## + + # perform the bulkier parts of the initialization process. + + if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo "heavyweight init begins..."; fi + + # 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 + source "$FEISTY_MEOW_LOADING_DOCK/fmc_core_and_custom_aliases.sh" + fi + + #echo before the new labelling, terminal titles have: + #show_terminal_titles + + # a minor tickle of the title of the terminal, unless we already have some history. + label_terminal_with_info + + if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo "heavyweight init is done."; fi + + if [ -z "$ERROR_OCCURRED" ]; then + # set a sentinel variable to say we loaded the feisty meow environment. + export FEISTY_MEOW_SCRIPTS_LOADED=true + fi + + 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 -fi # no error occurred. +fi # "$NO_REPAIRS_NEEDED" was == "true" diff --git a/scripts/core/reconfigure_feisty_meow.sh b/scripts/core/reconfigure_feisty_meow.sh index bcf187ac..b6421224 100644 --- a/scripts/core/reconfigure_feisty_meow.sh +++ b/scripts/core/reconfigure_feisty_meow.sh @@ -21,6 +21,9 @@ source "$CORE_SCRIPTS_DIR/functions.sh" export FEISTY_MEOW_APEX="$(/bin/pwd)" #echo feisty now is FEISTY_MEOW_APEX=$FEISTY_MEOW_APEX +# make the variables script run again. +unset CORE_VARIABLES_LOADED + # 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 @@ -42,7 +45,12 @@ if [ ! -d "$FEISTY_MEOW_LOADING_DOCK" ]; then mkdir -p "$FEISTY_MEOW_LOADING_DOCK" fi # need to add some paths explicitly until we've bootstrapped ourselves. -export PERLLIB=$PERLLIB:"$FEISTY_MEOW_SCRIPTS/files":"$FEISTY_MEOW_SCRIPTS/generator" +#hmmm: this is tasty reusable code... +export PERLLIB=$(echo $PERLLIB | sed -e "s?\([:]*\)\([^:]*feisty_meow[^:]*\)\([:]*\)??g") + +PERLLIB=$PERLLIB:"$FEISTY_MEOW_SCRIPTS/core":"$FEISTY_MEOW_SCRIPTS/files":"$FEISTY_MEOW_SCRIPTS/generator" +PERL5LIB=$PERLLIB +#echo PERLLIB after modification is $PERLLIB # make toast out of generated files right away, but leave any custom scripts. find "$FEISTY_MEOW_LOADING_DOCK" -maxdepth 1 -type f -exec perl "$FEISTY_MEOW_SCRIPTS/files/safedel.pl" "{}" ';' # &>/dev/null @@ -61,11 +69,13 @@ 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" +# create our common aliases. we need to refresh the PERLLIB since the shell +# seems to keep accumulating the value in a weird way. +PERLLIB=$PERLLIB PERL5LIB=$PERLLIB perl "$FEISTY_MEOW_SCRIPTS/core/generate_aliases.pl" +#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 ============== diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index e743345d..b6311dac 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -175,7 +175,6 @@ define_yeti_variable DEFAULT_FEISTYMEOW_ORG_DIR=/opt/feistymeow.org # variables for perl. define_yeti_variable PERLLIB+="/usr/lib/perl5" - define_yeti_variable PERL5LIB+="/usr/lib/perl5" if [ "$OS" == "Windows_NT" ]; then define_yeti_variable PERLIO=:perlio # choose perl's IO over the ms-windows version so we can handle file @@ -190,10 +189,10 @@ define_yeti_variable DEFAULT_FEISTYMEOW_ORG_DIR=/opt/feistymeow.org ls $i/*.pl &>/dev/null if [ $? -eq 0 ]; then PERLLIB+=":$(dos_to_unix_path $i)" - PERL5LIB+=":$(dos_to_unix_path $i)" fi fi done + define_yeti_variable PERL5LIB=$PERLLIB #echo PERLLIB is now $PERLLIB ############## diff --git a/scripts/generator/show_version.sh b/scripts/generator/show_version.sh new file mode 100644 index 00000000..5091b645 --- /dev/null +++ b/scripts/generator/show_version.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +# increments the build version number. + +#mkdir -p "$TEMPORARIES_PILE" + +#hmmm: looks like repeated reusable code below (compare with next_version) +export PARAMETER_FILE +if [ ! -z "$BUILD_PARAMETER_FILE" ]; then + # define our version of the build parameter file. this should be set + # beforehand so we override the default parameter file for clam. + PARAMETER_FILE="$BUILD_PARAMETER_FILE" +fi +if [ -z "$PARAMETER_FILE" ]; then + # last ditch attempt to get one that will work. + PARAMETER_FILE="$FEISTY_MEOW_APEX/build.ini" +fi + +#chmod u+w "$PARAMETER_FILE" + +#new_buildini="$(mktemp "$TEMPORARIES_PILE/buildini.XXXXXX")" +## whack the file just in case. +#rm -f "$new_buildini" +#echo -n "" >"$new_buildini" + +# pick a weird separator that we hope never to see. +IFS='~' + +found_version="" +skip_line="" + +major_string= +minor_string= +revision_string= + +#hmmm: now i know i'm having deja vu. this loop is a big chunk of reusable code that should be abstracted from this file and from next_version + +while read line_found; do + if [ $? != 0 ]; then break; fi +#echo line found is $line_found + if [ ! -z "$skip_line" ]; then + # we were told to skip this line to fix win32. + skip_line="" + continue + fi + + # these checks don't care about whether we've seen other stuff yet. + if [ -z "$major_string" ]; then + if [ ! -z "$(echo $line_found | sed -n -e 's/^ *major *=.*$/yep/p')" ]; then + major_string=$(echo $line_found | sed -e 's/.*=\(.*\)$/\1/' ) + fi + fi + if [ -z "$minor_string" ]; then + if [ ! -z "$(echo $line_found | sed -n -e 's/^ *minor *=.*$/yep/p')" ]; then + minor_string=$(echo $line_found | sed -e 's/.*=\(.*\)$/\1/' ) + fi + fi + + # we process the revision string line specially. + if [ -z "$found_version" ]; then + if [ "$line_found" == "#[version]" ]; then + # repair our special escape that makes this a valid ini file and + # gnu make include file. +# echo -e "#\\\\\n[version]" >>"$new_buildini" + found_version="yes" + continue + elif [ "$line_found" == "#" ]; then + # retarded win32 case. +# echo -e "#\\\\\n[version]" >>"$new_buildini" + found_version="yes" + skip_line="yes" + continue + fi + elif [ -z "$revision_string" ]; then + if [ ! -z "$(echo $line_found | sed -n -e 's/^ *revision *=.*$/yep/p')" ]; then + revision_string=$(echo $line_found | sed -e 's/.*=\(.*\)$/\1/' ) +#echo second part is $revision_string + revision_string=$(expr $revision_string + 1) +# echo "revision=$revision_string" >>"$new_buildini" + # don't print the line normally also. + continue + fi + fi + + # send the line with no special processing. +# echo "$line_found" >>"$new_buildini" + +done <"$PARAMETER_FILE" + +## if we created something with contents, let's use it. +#if [ -s "$new_buildini" ]; then +# cp "$new_buildini" "$PARAMETER_FILE" +#fi + +echo "Current build version is: $major_string.$minor_string.$revision_string" + +# don't leave the temporary version files floating around. +#rm -f "$new_buildini" + diff --git a/scripts/text/nechung_signature.sh b/scripts/text/nechung_signature.sh index 42448571..3ee02f4b 100644 --- a/scripts/text/nechung_signature.sh +++ b/scripts/text/nechung_signature.sh @@ -4,4 +4,3 @@ echo "
" echo "--
" $FEISTY_MEOW_BINARIES/nechung -