Merge branch 'master' of github.com:fredhamster/feisty_meow into dev
authorChris Koeritz <fred@gruntose.com>
Mon, 22 Jun 2020 19:31:23 +0000 (19:31 +0000)
committerChris Koeritz <fred@gruntose.com>
Mon, 22 Jun 2020 19:31:23 +0000 (19:31 +0000)
.gitignore
scripts/clam/cpp/rules.def
scripts/core/functions.sh
scripts/customize/fred/java_profile.sh
scripts/system/moodle_updater.sh [new file with mode: 0644]
scripts/tty/keep_awake.sh [deleted file]
scripts/tty/keep_awake_process.sh

index 022cb9f5218e8174c4fb339b344142d269567e42..a9f06ada1915a29642e616dba1431880fd7675dd 100644 (file)
@@ -7,6 +7,7 @@
 .DS_Store
 *.log
 *.gz
+.no-checkin
 *.o
 *.obj
 *_version.rc
index ca59f82360a30ad4341b456d98c1872406c927b5..7a04cc83c1bac59296339bd5e64a9ce81ead0a9a 100644 (file)
@@ -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)" ""
index 44f6155df5417f846af6e6110af554c6c007e271..0f356d6ef8d094550f32c8c924f5a37b529e0d7d 100644 (file)
@@ -437,9 +437,11 @@ if [ -z "$skip_all" ]; then
     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 "$@"
+    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=$?
 
     # take the xauth info away again if it wasn't set already.
@@ -930,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"
index b8e71a33b4827f2d67127d93a6c14e691a938703..f98030a679856d2d5dcec81fa4dcb87fabe4e23a 100644 (file)
@@ -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
diff --git a/scripts/system/moodle_updater.sh b/scripts/system/moodle_updater.sh
new file mode 100644 (file)
index 0000000..676b8a1
--- /dev/null
@@ -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 (file)
index 861425f..0000000
+++ /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) &
index 7c32cef738a2b28c8ca5421f3617e0af3960e42e..683575b19c257fe73b0ce43de3512a277990064d 100644 (file)
@@ -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