From: Chris Koeritz Date: Mon, 22 Jun 2020 19:31:19 +0000 (+0000) Subject: Merge branch 'dev' of feistymeow.org:feisty_meow into dev X-Git-Tag: 2.140.123^2~4^2~1 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=5a46095955145f2660c8e973f87469f7bcd8cc0b;hp=35f3c896a499f4bb3bd92eb865aad0f354b490c9;p=feisty_meow.git Merge branch 'dev' of feistymeow.org:feisty_meow into dev --- diff --git a/.gitignore b/.gitignore index 022cb9f5..a9f06ada 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ .DS_Store *.log *.gz +.no-checkin *.o *.obj *_version.rc diff --git a/infobase/configuration/ssh/mods_for_etc_sshd_config.txt b/infobase/configuration/ssh/mods_for_etc_sshd_config.txt new file mode 100644 index 00000000..322fdbac --- /dev/null +++ b/infobase/configuration/ssh/mods_for_etc_sshd_config.txt @@ -0,0 +1,17 @@ + +to increase security on an sshd server, and assuming you have +registered your ssh keys ahead of time in authorized_keys, then +this bit goes in /etc/sshd_config (at the end works fine): + +############## + +# fred mods 2019-02-19: +# trying to keep intruders out... this disables password logins. +# also of course disables root logins, which should already have been done. +PermitRootLogin no +ChallengeResponseAuthentication no +PasswordAuthentication no +UsePAM no + +############## + diff --git a/infobase/fortunes.dat b/infobase/fortunes.dat index ab0d4fd8..15e635f3 100644 --- a/infobase/fortunes.dat +++ b/infobase/fortunes.dat @@ -43885,3 +43885,18 @@ it will lead you home. -- from "The First Free Women: Poems of the Early Buddhist Nuns", by Matty Weingast +~ +If we are honest with ourselves, we know from our own experience that the more +we try to find solutions to our problems through thinking about them, the more +we start going around in circles, sometimes interminably. Buddhism counsels +us to resist being abused by our conflicting emotions and to let go of +excessive thinking. Emotions can be expressed in an unhealthy, self- +destructive manner or in a healthy and constructive fashion. Similarly, we +can think in a self-destructive, confused way, which reinforces our negative +habits, or we can think in a constructive way. Buddhism emphasizes that +overindulgence in conflicting emotions and distorted forms of thinking only +reinforces our old habits, which solidifies our karmic tendencies even +further. + -- Traleg Kyabgon, from "Mind at Ease: Self-Liberation through Mahamudra + Meditation", published by Shambhala Publications + diff --git a/production/feisty_meow_config.ini b/production/feisty_meow_config.ini index 838846f2..a780a635 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=121 +revision=122 build=420 # specifies the remainder of the version record info. diff --git a/scripts/archival/compare_backup_drive.sh b/scripts/archival/compare_backup_drive.sh index 501bfc97..4f36ceb4 100644 --- a/scripts/archival/compare_backup_drive.sh +++ b/scripts/archival/compare_backup_drive.sh @@ -22,7 +22,7 @@ echo would do-- compare_dirs "$target/$(basename $currdir)" "$currdir" # decide which drive to compare. targets="$1" if [ -z "$targets" ]; then - targets=($($(which ls) -1 /media/$USER/*)) + targets=($($(whichable ls) -1 /media/$USER/*)) if [ ${#targets[@]} -gt 1 ]; then echo " Please provide a media drive name on the command line, because more than diff --git a/scripts/archival/list_arch.sh b/scripts/archival/list_arch.sh index 2d5b6b1b..82e6fb7e 100644 --- a/scripts/archival/list_arch.sh +++ b/scripts/archival/list_arch.sh @@ -13,6 +13,8 @@ # An arbitrary format archive lister, although really we are mainly supporting # tar and zip currently, including compressed formats. +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" + archive_file="$1"; shift if [ -z "$archive_file" ]; then echo "This script takes one archive name (in .tar.gz, .zip, etc. formats) and" @@ -25,9 +27,9 @@ if [ ! -f "$archive_file" ]; then fi if [ -z "$PAGER" ]; then - PAGER=$(which less) + PAGER=$(whichable less) if [ -z "$PAGER" ]; then - PAGER=$(which more) + PAGER=$(whichable more) if [ -z "$PAGER" ]; then PAGER="cat" fi diff --git a/scripts/clam/cpp/rules.def b/scripts/clam/cpp/rules.def index ca59f823..7a04cc83 100644 --- a/scripts/clam/cpp/rules.def +++ b/scripts/clam/cpp/rules.def @@ -104,6 +104,10 @@ endif ############################################################################### ifeq "$(COMPILER)" "GNU_DARWIN" + # finds the crypto code on macos. + HEADER_SEARCH_PATH += /usr/local/opt/openssl/include + LIBRARY_SEARCH_PATH += /usr/local/opt/openssl/lib/ + ifneq "$(USE_XWIN)" "" DEFINITIONS += __XWINDOWS__ __X__ LIBS_USED += @@ -111,7 +115,7 @@ ifeq "$(COMPILER)" "GNU_DARWIN" #need to separate out with a USE_MOTIF kind of thing. #LIBS_USED += Xmu HEADER_SEARCH_PATH += /usr/include/X11 /usr/X11R6/include /usr/include/g++ - LIBRARY_SEARCH_PATH += /usr/X11R6/lib + LIBRARY_SEARCH_PATH += /usr/X11R6/lib endif ifneq "$(USE_SSL)" "" diff --git a/scripts/core/common.alias b/scripts/core/common.alias index e62e2e31..5143f048 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -14,7 +14,6 @@ ############## # make our functions available to the aliases. -#hmmm: should this be necessary? will it even work? source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" ############## @@ -47,11 +46,11 @@ if [ "$OS" != "Windows_NT" ]; then if [ -n "$IS_DARWIN" ]; then # case for mac os x. define_yeti_alias exp='open' - elif [ ! -z "$(which dolphin 2>/dev/null)" ]; then + elif [ ! -z "$(whichable dolphin)" ]; then # we prefer dolphin if available. define_yeti_alias exp='screen -L -S dolphin-$RANDOM -d -m dolphin ' #--select - elif [ ! -z "$(which nautilus 2>/dev/null)" ]; then + elif [ ! -z "$(whichable nautilus)" ]; then # launch nautilus if available. define_yeti_alias exp='nautilus' else diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 3a2151b1..0f356d6e 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -33,6 +33,20 @@ if [ -z "$skip_all" ]; then date +"%Y$sep%m$sep%d$sep%H%M$sep%S" | tr -d '/\n/' } + # a wrapper for the which command that finds items on the path. some OSes + # do not provide which, so we want to not be spewing errors when that + # happens. + function whichable() + { + to_find="$1"; shift + local WHICHER="$(\which which 2>/dev/null)" + if [ $? -ne 0 ]; then + # there is no which command here. we produce nothing due to this. + echo + fi + echo $($WHICHER $to_find 2>/dev/null) + } + # makes a directory of the name specified and then tries to change the # current directory to that directory. function mcd() { @@ -412,13 +426,6 @@ if [ -z "$skip_all" ]; then # be relied on for ssh forwarding, even if the '-i' flag is passed to cause # a fresh shell (which normally doesn't get the launching user's environment # variables). - -##questioning our approach: we also ensure that -# # the feisty meow environment is recreated; normal subshells don't need -# # this, but when switching identity with sudo, it seems important. yet, -# # we also don't want to hose up their normal sudo actions, such as passing -# # along the current environment, should the user choose. - function sudo() { save_terminal_title @@ -426,41 +433,21 @@ if [ -z "$skip_all" ]; then # this can allow root to use our display to show X.org windows. if [ -z "$IMPORTED_XAUTH" -a ! -z "$DISPLAY" ]; then export IMPORTED_XAUTH="$(xauth list $DISPLAY | head -n 1 | awk '{print $3}')" + local REMOVE_IMP_XAUTH=true fi # launch sudo with just the variables we want to reach the other side. - # we take an extra step to null out the PATH, since MacOS seems to want - # to pass that even for a login shell (-i) somehow. - PATH= /usr/bin/sudo --preserve-env=SSH_AUTH_SOCK,IMPORTED_XAUTH "$@" -#"SSH_AUTH_SOCK='$SSH_AUTH_SOCK'" "IMPORTED_XAUTH='$IMPORTED_XAUTH'" "$@" + local varmods= +# varmods+="PATH= " + if [ ! -z "$IMPORTED_XAUTH" ]; then varmods+="IMPORTED_XAUTH=$IMPORTED_XAUTH "; fi + if [ ! -z "$SSH_AUTH_SOCK" ]; then varmods+="SSH_AUTH_SOCK=$SSH_AUTH_SOCK"; fi + /usr/bin/sudo $varmods "$@" retval=$? - unset IMPORTED_XAUTH - restore_terminal_title - return $retval - -##potential boneyard: - # prep a simple command string here, rather than messing with arguments - # in the already complicated command below. i was seeing some really - # screwy behavior trying to expand $@ when embedded for the bash -c flag, - # but making the variable ahead of time gets rid of that. - cmd="/usr/bin/sudo --preserve-env=SSH_AUTH_SOCK,IMPORTED_XAUTH ""$@" - - # omit any variables that are either wrong for a different user or used - # to shield the feisty meow scripts from reconfiguring. when we do the - # sudo, we want a fresh start for feisty meow at least. - # our approach to launching sudo is further complicated by our sentinel - # alias, which normally is passed to any subshells (to prevent recreating - # aliases). we turn off the expand_aliases shell option to avoid passing - # the sentinel, which ensures aliases do get recreated for the new user. - BUILD_VARS_LOADED= \ - CORE_VARIABLES_LOADED= \ - FEISTY_MEOW_SCRIPTS_LOADED= \ - function_sentinel= \ - MAIL= \ - HOME= \ - bash +O expand_aliases -c "$cmd" - retval=$? + # take the xauth info away again if it wasn't set already. + if [ ! -z "$REMOVE_IMP_XAUTH" ]; then + unset IMPORTED_XAUTH + fi restore_terminal_title return $retval } @@ -475,7 +462,7 @@ if [ -z "$skip_all" ]; then # overlay for nechung binary so that we can complain less grossly about it when it's missing. function nechung() { - local wheres_nechung=$(which nechung 2>/dev/null) + local wheres_nechung=$(whichable nechung) if [ -z "$wheres_nechung" ]; then echo "The nechung oracle program cannot be found. You may want to consider" echo "rebuilding the feisty meow applications with this command:" @@ -591,20 +578,6 @@ automatic if there is even a small amount of doubt about the issue." echo } - # a wrapper for the which command that finds items on the path. some OSes - # do not provide which, so we want to not be spewing errors when that - # happens. - function whichable() - { - to_find="$1"; shift - which which &>/dev/null - if [ $? -ne 0 ]; then - # there is no which command here. we produce nothing due to this. - echo - fi - echo $(which $to_find) - } - function add_cygwin_drive_mounts() { for i in c d e f g h q z ; do #hmmm: improve this by not adding the link if already there, or if the drive is not valid. @@ -860,7 +833,7 @@ return 0 this_host=$(hostname) elif [ ! -z "$(echo $MACHTYPE | grep suse)" ]; then this_host=$(hostname --long) - elif [ -x "$(which hostname 2>/dev/null)" ]; then + elif [ -x "$(whichable hostname)" ]; then this_host=$(hostname) fi echo "$this_host" @@ -959,7 +932,21 @@ return 0 ############## - # site avenger aliases + # tty relevant functions... + + # keep_awake: sends a message to the screen from the background. + function keep_awake() + { + # just starts the keep_awake process in the background. + bash $FEISTY_MEOW_SCRIPTS/tty/keep_awake_process.sh & + # this should leave the job running as %1 or a higher number if there + # are pre-existing background jobs. + } + + ############## + + # site avenger functions... + function switchto() { THISDIR="$FEISTY_MEOW_SCRIPTS/site_avenger" diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index 8c21424f..9e3d1312 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -250,7 +250,7 @@ define_yeti_variable DEFAULT_FEISTYMEOW_ORG_DIR=/opt/feistymeow.org # initializes the feisty meow build variables, if possible. function initialize_build_variables() { - found_build_vars=0 + local found_build_vars=nope # we need to know the feisty meow directory, or we bail. if [ -z "$FEISTY_MEOW_APEX" ]; then return; fi # pick from our expected generator folder, but make sure it's there... @@ -258,10 +258,10 @@ define_yeti_variable DEFAULT_FEISTYMEOW_ORG_DIR=/opt/feistymeow.org if [ -f "$buildvars" ]; then # yep, that one looks good, so pull in the build defs. source "$buildvars" "$buildvars" - found_build_vars=1 + found_build_vars=true fi # now augment the environment if we found our build variables. - if [ $found_build_vars == 1 ]; then + if [ $found_build_vars == true ]; then # the binary directory contains our collection of handy programs. define_yeti_variable FEISTY_MEOW_BINARIES=$TARGETS_STORE # add binaries created within build to the path. @@ -331,20 +331,20 @@ export EDITOR # going to work well unless they can be prevented from forking the process # off. if [ -z "$EDITOR" ]; then - EDITOR="$(which gvim)" + EDITOR="$(whichable gvim)" if [ ! -z "$EDITOR" ]; then # if we found gvim, then add in the no forking flag. EDITOR+=" --nofork" fi fi if [ -z "$EDITOR" ]; then - EDITOR="$(which vim)" + EDITOR="$(whichable vim)" fi if [ -z "$EDITOR" ]; then - EDITOR="$(which vi)" + EDITOR="$(whichable vi)" fi if [ -z "$EDITOR" ]; then - EDITOR="$(which emacs)" + EDITOR="$(whichable emacs)" fi #### # out of ideas about editors at this point. diff --git a/scripts/customize/fred/java_profile.sh b/scripts/customize/fred/java_profile.sh index 99027e6f..f98030a6 100644 --- a/scripts/customize/fred/java_profile.sh +++ b/scripts/customize/fred/java_profile.sh @@ -22,16 +22,24 @@ function intuition_failure() ############################ -# set some fairly liberal limits for ant. -#no. export ANT_OPTS="-Xms512m -Xmx768m -XX:MaxPermSize=768m" - -############################ - # start guessing some settings... +# whatever we figure out, we want to export the java home variable. +export JAVA_HOME + # this bin portion works for most javas... export JAVA_BIN_PIECE=bin +# try using java itself to locate the JAVA_HOME if we can. +if [ ! -d "$JAVA_HOME" ]; then + JAVA_HOME=$(java -XshowSettings:properties -version 2>&1 | grep -i java.home | sed -e 's/.*java.home = \(.*\)$/\1/') +fi + +# if that didn't work, then we try a series of random bizarro places where +# we have seen java live before. + +#hmmm: below list is way out of date. we really hope the first attempt above works. + if [ ! -d "$JAVA_HOME" ]; then # try a recent version. export JAVA_HOME=/usr/lib/jvm/java-8-oracle @@ -65,7 +73,7 @@ fi if [ ! -d "$JAVA_HOME" ]; then unset JAVA_HOME unset JAVA_BIN_PIECE - if [ -z "$(whichable java 2>/dev/null)" ]; then + if [ -z "$(whichable java)" ]; then intuition_failure JAVA_HOME fi fi @@ -104,7 +112,7 @@ else ECLIPSE_DIR=$(echo $ECLIPSE_DIR | sed -e 's/^\(.\):/\/cygdrive\/\1/') fi fi -if [ -z "$ECLIPSE_DIR" -a -z "$(whichable eclipse 2>/dev/null)" ]; then +if [ -z "$ECLIPSE_DIR" -a -z "$(whichable eclipse)" ]; then intuition_failure ECLIPSE_DIR fi diff --git a/scripts/generator/build_variables.sh b/scripts/generator/build_variables.sh index 8c324acc..3031d317 100644 --- a/scripts/generator/build_variables.sh +++ b/scripts/generator/build_variables.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ############## # # Name : build variable calculator diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 5342ef2c..703e003d 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -15,8 +15,8 @@ source "$FEISTY_MEOW_SCRIPTS/tty/terminal_titler.sh" export MAX_DEPTH=5 # use our splitter tool for lengthy output if it's available. -if [ ! -z "$(which splitter 2>/dev/null)" ]; then - TO_SPLITTER="$(which splitter)" +if [ ! -z "$(whichable splitter)" ]; then + TO_SPLITTER="$(whichable splitter)" # calculate the number of columsn in the terminal. cols=$(get_maxcols) TO_SPLITTER+=" --maxcol $(($cols - 1))" diff --git a/scripts/schedule/generate_reminders.pl b/scripts/schedule/generate_reminders.pl index 0769ddf8..3e1351a2 100644 --- a/scripts/schedule/generate_reminders.pl +++ b/scripts/schedule/generate_reminders.pl @@ -21,10 +21,12 @@ # # Apr 24 Saint Shanty's Day # Jul 8 Normality Day +# Oct 24 1985 Saint Splivven's Day # # Month names must currently be three letters and must be capitalized. -# The day must be a number, followed by a space. Anything after that -# space is considered the description of the event. +# The day must be a number, followed by a space. An optional 4 digit +# year can be included. Anything after that is considered to be the +# description of the event. use Env qw(CLOUD_BASE TMP); diff --git a/scripts/system/list_packages.sh b/scripts/system/list_packages.sh index 60024c75..0a52aa64 100644 --- a/scripts/system/list_packages.sh +++ b/scripts/system/list_packages.sh @@ -16,14 +16,14 @@ if debian_like; then exit $? fi -rpm_available="$(which rpm)" +rpm_available="$(whichable rpm)" if [ ! -z "$rpm_available" ]; then #is that the right phrase for rpm? somewhat forgotten. rpm -qa | eval $SEEK_PIECE exit $? fi -yum_available="$(which yum)" +yum_available="$(whichable yum)" if [ ! -z "$yum_available" ]; then yum list | eval $SEEK_PIECE exit $? diff --git a/scripts/system/moodle_updater.sh b/scripts/system/moodle_updater.sh new file mode 100644 index 00000000..676b8a1e --- /dev/null +++ b/scripts/system/moodle_updater.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# updates the moodle install, assuming all paths are at the default. + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" + +#### +# some constants that we know are not really. +moodle_parent=/var/www/html + # parent directory is one level up from where moodle lives. +moodle_dir=moodle + # this variable is just the directory name for moodle itself, not a path. +moodle_release=moodle-3.9 + # the name of the release we're expecting to download and install +download_url="https://download.moodle.org/download.php/direct/stable39/${moodle_release}.tgz" + # where we can get the latest version of moodle for our chosen releases. +#### + +# everything below should be version invariant. + +moodle_path="$moodle_parent/$moodle_dir" + # composing the parent plus directory name should get us to moodle. + +if [ ! -d "$moodle_path" ]; then + echo "There was no moodle installation found at: $moodle_path" + exit 1 +fi + +# where we unpack our temporary stuff. +temp_install="$(mktemp -d /tmp/update_moodle.XXXXXX)" +#echo temp install dir is: $temp_install +if [ ! -d "$temp_install" ]; then + echo The temporary installation directory at: $temp_install could not be created. + exit 1 +fi + +# quit the running moodle instance. +systemctl stop httpd +exit_on_error stopping httpd process before moodle upgrade. + +# jump into our new work area. +pushd "$temp_install" + +# get the latest moodle version. this could change over time, +# but it's the best link i could find. +wget "$download_url" +exit_on_error downloading latest version of moodle. + +# use the feisty meow unpack script to extract the moodle data. +unpack "${moodle_release}.tgz" +exit_on_error unpacking latest version of moodle. + +# rename the old moodle directory to a unique name in the same area. +old_moodle_path="$moodle_parent/moodle-$(basename $temp_install)" +mv "$moodle_parent/$moodle_dir" "$old_moodle_path" +exit_on_error renaming old version of moodle. + +# move the new stuff into place. +mv "${moodle_release}/$moodle_dir" "$moodle_parent"/ +exit_on_error moving new version of moodle into place. + +# grab our important configuration files and put them back in the new directory. +cp "$old_moodle_path/config.php" "$moodle_path" +exit_on_error copying existing moodle configuration file: config.php + +echo -e "\ +==== +NOTE: This script does not copy any plugins or themes. If you are using\n\ +updated or specialized additions to moodle, please copy them from here:\n\ + $old_moodle_path\n\ +into the new install at:\n\ + $moodle_path\n\ +====\n\ +" + +# restart the running moodle instance. +systemctl stop httpd +exit_on_error starting httpd process after moodle upgrade. + +# sunshine and roses! we are through the gauntlet. + diff --git a/scripts/tty/keep_awake.sh b/scripts/tty/keep_awake.sh deleted file mode 100644 index 861425f3..00000000 --- a/scripts/tty/keep_awake.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# keep_awake: sends a message to the screen from the background. -# -# This program is really just a way to start the keep_awake process in the -# background instead of needing to start a subshell here. There was some -# kind of snafu with the ksh environment variable $$ where it would always -# record the previous shell's number and not the current one or something.... -# -(bash $FEISTY_MEOW_SCRIPTS/tty/keep_awake_process.sh) & diff --git a/scripts/tty/keep_awake_process.sh b/scripts/tty/keep_awake_process.sh index 7c32cef7..683575b1 100644 --- a/scripts/tty/keep_awake_process.sh +++ b/scripts/tty/keep_awake_process.sh @@ -1,18 +1,18 @@ #!/bin/bash + # This program is meant to be started by the program keep_awake and has -# the basic guts that are meant to execute inside of a semi-perpetual loop. +# the guts that are meant to execute inside of a semi-perpetual loop. source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +#hmmm: is there still a process management thingy, referred to below, active in our scripts??? # save the process id for the goodbye program to deal with. #echo $$ >>$TMP/trash.last_keep_awake_process #don't let the shutdown guy know who we are; we want to keep running now. # loop sort of forever. while true; do -# this version is for keeping a modem awake. -# ping -c 7 www.gruntose.com >/dev/null - - echo "trying not to fall asleep at $(date_stringer)" - sleep 120 + echo -e "\n\ntrying not to fall asleep at $(date_stringer)\n" + # magical number of seconds to sleep... + sleep 64 done