Merge branch 'release-2.140.113' 2.140.113
authorChris Koeritz <fred@gruntose.com>
Sat, 26 May 2018 02:24:56 +0000 (22:24 -0400)
committerChris Koeritz <fred@gruntose.com>
Sat, 26 May 2018 02:24:56 +0000 (22:24 -0400)
new release 2.140.113

infobase/configuration/cron/time_synch.crontab
infobase/examples/bashisms/dot.bash_logout
production/feisty_meow_config.ini
scripts/archival/pack_feisty_meow.sh
scripts/customize/fred/fred_variables.sh
scripts/files/act_on_tree.sh [new file with mode: 0644]
scripts/rev_control/version_control.sh
scripts/site_avenger/act_on_apps.sh [new file with mode: 0644]
scripts/site_avenger/powerup.sh
scripts/site_avenger/shared_site_mgr.sh
scripts/text/interactive_underscores_to_spaces.sh [new file with mode: 0644]

index 77e41d5c698013224729bf93d3fe9b74945008f8..f59270620a163c867b71d5d42975d30dc68e1da9 100644 (file)
@@ -2,13 +2,15 @@
 #[time synch]
 
 # standard to synch to local machine.
-#0,4,8,12,16,20,24,28,32,36,40,44,48,52,56 * * * * /usr/sbin/sntp -P no -r greendragon &>>/tmp/${CRONUSER}-cron-time_synch.log
-#or
-0,4,8,12,16,20,24,28,32,36,40,44,48,52,56 * * * * /usr/bin/rdate -s -n greendragon &>>/tmp/${CRONUSER}-cron-time_synch.log
-# -n is nntp which may not work with govt servers.
+
+##############
+
+# synchronize time/date with our nearest time server.
+*/4 * * * * /usr/sbin/ntpdate greendragon &>>/tmp/${CRONUSER}-cron-time_synch.log
+
+##############
 
 # one machine on the network uses this version, to synch externally.
-#0 0,4,8,12,16,20 * * * /usr/sbin/sntp -P no -r time.nist.gov &>>/tmp/${CRONUSER}-cron-time_synch.log
-#or
 0 0,4,8,12,16,20 * * * /usr/bin/rdate -s time.nist.gov &>>/tmp/${CRONUSER}-cron-time_synch.log
+#hmmm: is above still correct?
 
index ab2ba32b3d23ea47a67f9ba0f825b8b352d69fa2..c01a5ffda585f1930858c698c3b4dcbf79adcbfe 100644 (file)
@@ -3,4 +3,5 @@
 sep 79
 $FEISTY_MEOW_GENERATED_STORE/runtime/binaries/nechung 
 echo
+sleep 1
 
index 492e59c5ec9f630f203b741c77f431e6326b273b..d679b4332b6407668d373e337a80e0142693431c 100644 (file)
@@ -3,7 +3,7 @@
 # specifies the version of the code that is being constructed here.
 major=2
 minor=140
-revision=112
+revision=113
 build=420
 
 # specifies the remainder of the version record info.
index 1596fd4458ccae3ea1660a30d175ddc2726cddb2..cb3d4a0fffbd22f816cfe8e9299f8be94a2756e4 100644 (file)
@@ -2,19 +2,30 @@
 
 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
 
+# location where we intend to store these packages.
+RELEASE_PATH="$WEBBED_SITES/feistymeow.org/releases"
+
+# check that we can see the release path.
+if [ ! -d "$RELEASE_PATH" ]; then
+  echo "The release path does not exist: $RELEASE_PATH"
+  exit 1
+fi
+
 TEMPO_FILE="$(mktemp "$TMP/zz_feistypack.XXXXXX")"
   # specify where we keep the file until we're ready to move it.
 
-# shortcut for the lengthy exclude parameter.
-# note that this only works on file patterns apparently, like *.hosed,
-# instead of working with general patterns (like */code_guide/*).
-export XC='--exclude='
+log_feisty_meow_event "packing feisty meow in temporary file $TEMPO_FILE"
 
 parent_dir="$(dirname "$FEISTY_MEOW_APEX")"
 base_dir="$(basename "$FEISTY_MEOW_APEX")"
 
 pushd $parent_dir
 
+# shortcut for the lengthy exclude parameter.
+# note that this only works on file patterns apparently, like *.hosed,
+# instead of working with general patterns (like */code_guide/*).
+export XC='--exclude='
+
 # archive feisty meow current state, but exclude the file names we never want
 # to see in the archive.  the exclude vcs flag takes care of excluding
 # revision control system private dirs.  first chunk of excludes is for the
@@ -42,7 +53,7 @@ $base_dir
 
 # now move the newest version into its resting place.  this prepares the
 # feisty_meow package for uploading.
-mv -v $TEMPO_FILE $WEBBED_SITES/feistymeow.org/releases/feisty_meow_codebase_$(date_stringer).tar.gz
+mv -v $TEMPO_FILE "$RELEASE_PATH/feisty_meow_codebase_$(date_stringer).tar.gz"
 
 popd
 
index ec1720310d3688ed79716fdb4691983901a3f6bb..64f28c17eecccc9f4c86ed372380fb6a16181850 100644 (file)
@@ -18,7 +18,7 @@ if [ -z "$USER_CUSTOMIZATIONS_LOADED" ]; then
   REPOSITORY_LIST=" cloud ebooks web ${REPOSITORY_LIST} "
 
   # adds our locally relevant archive folders into the list to be synched.
-  MAJOR_ARCHIVE_SOURCES+="/z/archons /z/basement /z/imaginations /z/musix /z/toaster /z/walrus"
+  MAJOR_ARCHIVE_SOURCES+="/z/archons /z/basement /z/imaginations /z/musix /z/toaster /z/walrus $HOME/brobdingnag"
   # our set of known source hierarchy folder names.
   SOURCECODE_HIERARCHY_LIST="codebarn extra_brain interbrane"
 
diff --git a/scripts/files/act_on_tree.sh b/scripts/files/act_on_tree.sh
new file mode 100644 (file)
index 0000000..86cf685
--- /dev/null
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+# act_on_tree: performs a command on a hierarchy of directories.
+#
+# a handy way to run a command across a set of folders.
+
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
+
+#echo command line in act_on_tree is: $*
+
+if [ -z "$APP_NAME" ]; then
+  APP_NAME="$(basename $0 .sh)"
+fi
+
+function print_instructions_and_exit()
+{
+  echo "
+$APP_NAME [-d directory] [-f subfolder] action1 [action2...]
+
+This script runs an action command on each of the folders that live under the
+current directory (going one level down from this directory, not recursively).
+The single action command to run is built from the pieces action1, action2,
+and so on that are provided on the command line.
+
+For example, this command:
+  $APP_NAME git branch
+will show the branch information on each project under the current directory.
+
+You can specify an alternate directory to use with the '-d' flag, e.g.:
+  $APP_NAME -d ~/turnip_codes/ ant clean build
+
+You can provide a sub-folder name with -f that must exist and which the script
+changes the directory to before the command is run.  This supports hierarchies
+where the action must take place below the children of the -d directory.
+  $APP_NAME -f avenger5 rgetem
+
+The flags and their parameters must precede the action1... arguments.
+
+"
+  exit 1
+}
+
+changes=true
+
+while [ $changes == true ]; do
+  changes=nope
+
+  # check if they gave us a special directory flag.
+  if [ "$1" == "-d" ]; then
+    shift  # toss the -d.
+    # grab the directory they want to actually use.
+    seekdir="$1"; shift
+    # check for more flags.
+    changes=true
+  fi
+
+  # check if they gave us a subfolder name flag.
+  if [ "$1" == "-f" ]; then
+    shift  # toss the -f.
+    # get their preferred subfolder.
+    subfoldername="$1"; shift
+    # check for more flags.
+    changes=true
+  fi
+done
+
+# check that there are some remaining parms for the action pieces.
+if [ -z "$*" ]; then
+  print_instructions_and_exit
+fi
+
+# plug in our defaults.
+if [ -z "$seekdir" ]; then
+  seekdir="."
+fi
+if [ -z "$subfoldername" ]; then
+  subfoldername="."
+fi
+
+sep 28
+
+pushd $seekdir &>/dev/null
+
+for i in *; do
+  if [ -d "$i" -a -d "$i/$subfoldername" ]; then
+    pushd "$i/$subfoldername" &>/dev/null
+    echo "[in '$i' running action: $*]"
+    $* 
+    sep 28
+    popd &>/dev/null
+  fi
+done
+
+popd &>/dev/null
+
index b48ff25347b6aa5ff07c478f4126a384039cb253..737f314cb2368ede6157083be13f1165a7aae42c 100644 (file)
@@ -77,26 +77,36 @@ function do_revctrl_checkin()
   if [ $nicedir == "." ]; then
     nicedir=$(\pwd)
   fi
-  local blatt="echo -ne \nchecking in '$nicedir'...  "
+  local blatt_report="echo -ne \nchecking in '$nicedir'...  "
+  local tell_no_checkin="echo -ne \nskipping check-in due to presence of .no-checkin sentinel file: $nicedir"
 
   pushd "$directory" &>/dev/null
-  if [ -f ".no-checkin" ]; then
-    echo -ne "\nskipping check-in due to presence of .no-checkin sentinel file: $directory"
-  elif [ -d "CVS" ]; then
+#hmmm: overly elaborate sections below here, but we do want precise handling for git case.
+  if [ -d "CVS" ]; then
     if test_writeable "CVS"; then
       do_revctrl_simple_update "$directory"
       exit_on_error "updating repository; this issue should be fixed before check-in."
-      $blatt
-      cvs ci .
-      exit_on_error "cvs checkin"
+      if [ -f ".no-checkin" ]; then
+#        echo -ne "\nskipping check-in due to presence of .no-checkin sentinel file: $directory"
+        $tell_no_checkin
+      else
+        $blatt_report
+        cvs ci .
+        exit_on_error "cvs checkin"
+      fi
     fi
   elif [ -d ".svn" ]; then
     if test_writeable ".svn"; then
       do_revctrl_simple_update "$directory"
       exit_on_error "updating repository; this issue should be fixed before check-in."
-      $blatt
-      svn ci .
-      exit_on_error "svn checkin"
+      if [ -f ".no-checkin" ]; then
+#        echo -ne "\nskipping check-in due to presence of .no-checkin sentinel file: $directory"
+        $tell_no_checkin
+      else
+        $blatt_report
+        svn ci .
+        exit_on_error "svn checkin"
+      fi
     fi
   elif [ -d ".git" ]; then
     if test_writeable ".git"; then
@@ -104,39 +114,43 @@ function do_revctrl_checkin()
       # take steps to make sure the branch integrity is good and we're up to date against remote repos.
       do_revctrl_careful_update "$(\pwd)"
 
-      $blatt
+      if [ -f ".no-checkin" ]; then
+#        echo -ne "\nskipping check-in due to presence of .no-checkin sentinel file: $directory"
+        $tell_no_checkin
+      else
+        $blatt_report
 
-      # put all changed and new files in the commit.  not to everyone's liking.
-      git add --all . | $TO_SPLITTER
-      promote_pipe_return 0
-      exit_on_error "git add all new files"
+        # put all changed and new files in the commit.  not to everyone's liking.
+        git add --all . | $TO_SPLITTER
+        promote_pipe_return 0
+        exit_on_error "git add all new files"
 
-      # see if there are any changes in the local repository.
-      if ! git diff-index --quiet HEAD --; then
-        # tell git about all the files and get a check-in comment.
+        # see if there are any changes in the local repository.
+        if ! git diff-index --quiet HEAD --; then
+          # tell git about all the files and get a check-in comment.
 #hmmm: begins to look like, you guessed it, a reusable bit that all commit actions could enjoy.
-        git commit .
-        retval=$?
-        continue_on_error "git commit"
-        if [ $retval -ne 0 ]; then
-          echo -e -n "Commit failed or was aborted:\nShould we continue with other check-ins? [y/N] "
-          local line
-          read line
-          if [[ "${line:0:1}" != "y" ]]; then
-            echo "Stopping check-in process due to missing commit and user request."
-            exit 1
+          git commit .
+          retval=$?
+          continue_on_error "git commit"
+          if [ $retval -ne 0 ]; then
+            echo -e -n "Commit failed or was aborted:\nShould we continue with other check-ins? [y/N] "
+            local line
+            read line
+            if [[ "${line:0:1}" != "y" ]]; then
+              echo "Stopping check-in process due to missing commit and user request."
+              exit 1
+            fi
           fi
         fi
-      fi
 
-      # we continue on to the push, even if there were no obvious changes this run, because
-      # there could already be committed changes that haven't been pushed yet.
-
-      # upload any changes to the upstream repo so others can see them.
-      git push --tags origin "$(my_branch_name)" 2>&1 | grep -v "X11 forwarding request failed" | $TO_SPLITTER
-      promote_pipe_return 0
-      exit_on_error "git push"
+        # we continue on to the push, even if there were no obvious changes this run, because
+        # there could already be committed changes that haven't been pushed yet.
 
+        # upload any changes to the upstream repo so others can see them.
+        git push --tags origin "$(my_branch_name)" 2>&1 | grep -v "X11 forwarding request failed" | $TO_SPLITTER
+        promote_pipe_return 0
+        exit_on_error "git push"
+      fi
     fi
   else
     # nothing there.  it's not an error though.
@@ -318,8 +332,8 @@ function do_revctrl_careful_update()
   if [ $nicedir == "." ]; then
     nicedir=$(\pwd)
   fi
-  local blatt="echo -e \ncarefully retrieving '$nicedir'..."
-  $blatt
+  local blatt_report="echo -e \ncarefully retrieving '$nicedir'..."
+  $blatt_report
 
   local this_branch="$(my_branch_name)"
 
@@ -380,26 +394,26 @@ function do_revctrl_simple_update()
   if [ $nicedir == "." ]; then
     nicedir=$(\pwd)
   fi
-  local blatt="echo -e \nretrieving '$nicedir'..."
+  local blatt_report="echo -e \nretrieving '$nicedir'..."
 
   pushd "$directory" &>/dev/null
   if [ -d "CVS" ]; then
     if test_writeable "CVS"; then
-      $blatt
+      $blatt_report
       cvs update . | $TO_SPLITTER
       promote_pipe_return 0
       exit_on_error "cvs update"
     fi
   elif [ -d ".svn" ]; then
     if test_writeable ".svn"; then
-      $blatt
+      $blatt_report
       svn update . | $TO_SPLITTER
       promote_pipe_return 0
       exit_on_error "svn update"
     fi
   elif [ -d ".git" ]; then
     if test_writeable ".git"; then
-      $blatt
+      $blatt_report
       git pull --tags $PULL_ADDITION 2>&1 | grep -v "X11 forwarding request failed" | $TO_SPLITTER
       promote_pipe_return 0
       exit_on_error "git pull of origin"
diff --git a/scripts/site_avenger/act_on_apps.sh b/scripts/site_avenger/act_on_apps.sh
new file mode 100644 (file)
index 0000000..32cb32e
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# run a command on all of the existing apps folders, but only if they appear to have site avenger projects in them.
+
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
+
+# fix the app name for our call to the act_on_tree script.
+export APP_NAME="$(basename $0 .sh)"
+
+act_on_tree -f avenger5 -d ~/apps "${@}"
+
+
index ef4c0976c999ed7c1e029798ea7f8738719538f4..e187202f3ea6769489e658acba1301d0be99d4a8 100644 (file)
@@ -91,8 +91,7 @@ echo "Repository: $repo_name"
 echo "Theme name: $theme_name"
 sep
 
-echo in powerup before update repo with:
-var CHECKOUT_DIR_NAME DEFAULT_REPOSITORY_ROOT
+log_feisty_meow_event "in powerup before update repo with: $(var CHECKOUT_DIR_NAME DEFAULT_REPOSITORY_ROOT)"
 
 # this should set the site_store_path variable if everything goes well.
 update_repo "$full_app_dir" "$CHECKOUT_DIR_NAME" "$DEFAULT_REPOSITORY_ROOT" "$repo_name"
index 015d3e68f9485ca4d2015cd6c180e1d259f1718c..e2d2cdcea5b4b5e017732166d807a956a2a18da3 100644 (file)
@@ -40,6 +40,54 @@ function check_apps_root()
   fi
 }
 
+#hmmm: extract to core somewhere...
+# locates a parent directory of a certain name, if possible.  returns success
+# (as zero) if the directory was found, and failure if there was no parent
+# named as requested.  sets a global variable PARENT_DIR_FOUND to the full
+# directory name that matched, including the name being sought (but omitting
+# any deeper directories than that).
+function find_named_parent_dir()
+{
+  local dir_name_sought="$1"; shift
+  # clear any previous global result.
+  unset PARENT_DIR_FOUND
+  # check for degenerate case of parameter count.
+  if [ -z "$dir_name_sought" ]; then
+    echo "
+find_named_parent_dir: requires a directory name parameter, which will be
+sought out above the current directory.  the return value indicates whether
+the requested name was found or not.
+"
+    return 1
+  fi
+  # signal a failure by default with our return value.
+  local retval=1
+  # loop upwards in dir hierarchy to find the name.
+  while true; do
+    local currdir="$(\pwd)"
+    if [ "$currdir" == "/" ]; then
+      # we climbed out of all subdirs.  this is a failure case.
+      retval=1
+      break
+    fi
+    # get the base part of our name to check on success.
+    local base="$(basename "$currdir")"
+    if [ "$base" == "$dir_name_sought" ]; then
+      # yes, that is the right name.  success case.  save our result.
+      export PARENT_DIR_FOUND="$currdir"
+      retval=0
+      break
+    fi
+    # hop up a directory.
+    pushd .. &>/dev/null
+  done
+
+  # rollback any directories we pushed.
+  while popd &>/dev/null; do true; done
+
+  return $retval
+}
+
 # tries to find an appropriate config file for the application.
 function locate_config_file()
 {
@@ -80,7 +128,7 @@ function find_app_folder()
   unset app_dirname
   
   # count number of directories...  if exactly one, then choose it.
-  numdirs=$(count_directories "$appsdir")
+  numdirs=$(count_directories "$appsdir/")
 
   if [ $numdirs -eq 0 ]; then
     sep
@@ -91,28 +139,45 @@ function find_app_folder()
     echo "on the command line, e.g.:"
     echo "  $(basename $0) turtle"
     sep
-    exit 1
+    return 1
   elif [ $numdirs -eq 1 ]; then
-    app_dirname="$(basename $(find "$appsdir" -mindepth 1 -maxdepth 1 -type d) )"
+    # one directory in apps, so we'll pick that one.
+    app_dirname="$(basename $(find "$appsdir" -follow -mindepth 1 -maxdepth 1 -type d) )"
     exit_on_error "Guessing application folder"
   else
-    # if more than one folder, force user to choose.
-    # Reference: https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script
-    holdps3="$PS3"
-    PS3='Please pick a folder for site initialization: '
-    options=( $(find "$appsdir" -mindepth 1 -maxdepth 1 -type d -exec basename {} ';') "Quit")
-    select app_dirname in "${options[@]}"; do
-      case $app_dirname in
-        "Quit") echo ; echo "Quitting from the script."; return 1; ;;
-        *) echo ; echo "You picked folder '$app_dirname'" ; break; ;;
-      esac
-    done
-    if [ -z "$app_dirname" ]; then
-      echo "The folder was not provided.  This script needs a directory name"
-      echo "within which to initialize the site."
-      return 1
+    # there's more than one folder in apps...
+
+    # make sure we're allowed to auto-guess the folder name from our current dir.
+    if [ -z "$NO_AUTOMATIC_FOLDER_GUESS" ]; then
+      # if we can find an avenger5 directory above our current PWD, then that
+      # might tell us our name.
+      if  find_named_parent_dir "avenger5"; then
+        # we can grab a name above the avenger5 location.  let's try that.
+        app_dirname="$(basename "$(dirname $PARENT_DIR_FOUND)" )"
+      fi
+    else
+      # flag maintenance, to avoid hosing other commands by leaving this set.
+      unset NO_AUTOMATIC_FOLDER_GUESS
+
+      # well, we couldn't guess a directory based on our current location,
+      # so ask the user to choose.
+      # Reference: https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script
+      holdps3="$PS3"
+      PS3='Please pick a folder for site initialization: '
+      options=( $(find "$appsdir" -follow -mindepth 1 -maxdepth 1 -type d -exec basename {} ';') "Quit")
+      select app_dirname in "${options[@]}"; do
+        case $app_dirname in
+          "Quit") echo ; echo "Quitting from the script."; return 1; ;;
+          *) echo ; echo "You picked folder '$app_dirname'" ; break; ;;
+        esac
+      done
+      if [ -z "$app_dirname" ]; then
+        echo "The folder was not provided.  This script needs a directory name"
+        echo "within which to initialize the site."
+        return 1
+      fi
+      PS3="$holdps3"
     fi
-    PS3="$holdps3"
   fi
   test_app_folder "$appsdir" "$app_dirname"
   exit_on_error "Testing application folder: $app_dirname"
@@ -398,12 +463,15 @@ function switch_to()
   # find proper webroot where the site will be initialized.
   if [ -z "$app_dirname" ]; then
     # no dir was passed, so guess it.
+    export NO_AUTOMATIC_FOLDER_GUESS=true
     find_app_folder "$BASE_APPLICATION_PATH"
   else
     test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
   fi
   if [ $? -ne 0 ]; then
-    echo "Could not locate the application directory: ${app_dirname}"
+    if [ "$app_dirname" != "Quit" ]; then
+      echo "Could not locate the application directory: ${app_dirname}"
+    fi
     return 1
   fi
 
diff --git a/scripts/text/interactive_underscores_to_spaces.sh b/scripts/text/interactive_underscores_to_spaces.sh
new file mode 100644 (file)
index 0000000..9d41452
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
+
+while true; do
+  sep 14 
+  read line || break
+  echo "< $line"
+  echo "> $line" | sed -e 's/_/ /g'
+done
+