From: Fred T. Hamster Date: Sun, 6 Apr 2025 12:52:21 +0000 (-0400) Subject: tasty updates for comparator X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=bde11e4a8e7d54deb3038af3a94ab3d6596f5eb2;p=feisty_meow.git tasty updates for comparator 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. --- diff --git a/scripts/archival/comparator.sh b/scripts/archival/comparator.sh index 00f2f91e..84645cc5 100644 --- a/scripts/archival/comparator.sh +++ b/scripts/archival/comparator.sh @@ -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" diff --git a/scripts/archival/general_updater.sh b/scripts/archival/general_updater.sh index 0635a984..a9677c88 100644 --- a/scripts/archival/general_updater.sh +++ b/scripts/archival/general_updater.sh @@ -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 } diff --git a/scripts/files/compare_dirs.sh b/scripts/files/compare_dirs.sh index 3224cda6..31cc450d 100644 --- a/scripts/files/compare_dirs.sh +++ b/scripts/files/compare_dirs.sh @@ -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