tasty updates for comparator
authorFred T. Hamster <fred@gruntose.com>
Sun, 6 Apr 2025 12:52:21 +0000 (08:52 -0400)
committerFred T. Hamster <fred@gruntose.com>
Sun, 6 Apr 2025 12:52:21 +0000 (08:52 -0400)
now very much a reusable tool for others, since the hard-coded names for the comparator have
been cleaned up.  now these scripts just use the MAJOR_ARCHIVE_SOURCES and the command line
parameters to ferret out the proper locations to synch.
successfully used against both localhost, a remote host, and a local disk archive now.

scripts/archival/comparator.sh
scripts/archival/general_updater.sh
scripts/files/compare_dirs.sh

index 00f2f91ea45038359b8ae36f4a531144182d2609..84645cc5139a801c48c788b890a0cf3737a47743 100644 (file)
@@ -4,16 +4,17 @@
 
 remote_place="$1"; shift
 if [ -z "$remote_place" ]; then
-  remote_place=wildmutt
+  remote_place=morpheus.gruntose.blurgh:/z
   #remote_place=curie
 fi
-local_place="$1"; shift
-if [ -z "$local_place" ]; then
-  local_place=/z
-fi
+#local_place="$1"; shift
+#if [ -z "$local_place" ]; then
+#  local_place=/z
+#fi
 
 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
 source "$FEISTY_MEOW_SCRIPTS/archival/general_updater.sh"
 
-uber_archive_comparator "$remote_place" "$local_place"
+uber_archive_comparator "$remote_place" 
+#"$local_place"
 
index 0635a984ff8b4e15717a83d936f7329a2391a76e..a9677c88baf608cdb6d9c8884ef24c106cff3512 100644 (file)
@@ -145,10 +145,11 @@ function do_a_folder_compare()
 }
 
 # runs through all the local archives on this host to make sure nothing is
-# different when compared with the mainline versions on the specified host.
-# the first parameter is the remote version to compare against.  if there is
-# a second parameter, it is used as the path on the local machine where the
-# comparison should be based (e.g. an archive drive rather than /z/).
+# different when compared with the mainline versions on the specified host
+# or target directory.
+# the first parameter is the remote version to compare against.  it needs to
+# include both the host and the directory path for comparison, e.g.:
+#   uber_archive_comparator obsidian.gruntose.blurgh:/z
 function uber_archive_comparator()
 {
   local remote_arch="$1"; shift
@@ -156,24 +157,30 @@ function uber_archive_comparator()
     echo uber_archive_comparator needs the remote archive host to compare with.
     return 1
   fi
-  local local_place="$1"; shift
-  if [ -z "$local_place" ]; then
-    local_place="/z"
-  fi
 
   sep 14
   echo "comparing against host '$remote_arch'"
   sep 14
 
-#hmmm: shouldn't this be a list in a variable someplace?
-  for archicle in \
-    basement \
-    imaginations \
-    musix \
-    toaster \
-    walrus \
-    ; do
-      do_a_folder_compare ${archicle} ${local_place} ${remote_arch} "/z"
+  # remote_host needs just the remote host.
+  local remote_host="${remote_arch%%:*}"
+  # remote_dir needs the hostname portion stripped out.
+  local dir_remote="${remote_arch##*:}"
+
+  if [ "$remote_host" == "$dir_remote" ]; then
+    echo "failure in parsing parameters--the remote destination is missing a directory."
+    return 1
+  fi
+
+#echo "remote arch: '$remote_arch'"
+#echo "remote host: '$remote_host'"
+#echo "dir remote: '$dir_remote'"
+
+  for archicle in $MAJOR_ARCHIVE_SOURCES; do
+    local local_base="$(basename $archicle)"
+    local local_dir="$(dirname $archicle)"
+#echo do_a_folder_compare "${local_base}" "${local_dir}" "${remote_host}" "${dir_remote}" 
+    do_a_folder_compare "${local_base}" "${local_dir}" "${remote_host}" "${dir_remote}"
   done
 }
 
index 3224cda68ffbebcdf39e625c52e3d98f0318dfa9..31cc450d8a0408fd2dc4a2628c7d5f92e5dc2591 100644 (file)
@@ -51,6 +51,7 @@ if [ -z "$host1" ]; then
   popd &>/dev/null
 else
   # remote compare location for first dir.
+echo will run: ssh $host1 \"cd \$dir1 && find .\"
   ssh "$host1" "cd \"$dir1\" && find ." >"$out1"
   exit_on_error "compare_dirs: listing remote directory $dir1"
 fi