From f41227cc035ed897f140af2fa73acd517d0d856e Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Thu, 18 Oct 2018 13:07:43 -0400 Subject: [PATCH] made a general comparator for my archives not completely general yet, since archives list is encoded in script, but a lot nicer and closer to what i want for any machine. --- scripts/archival/comparator.sh | 16 ++++++ scripts/archival/general_updater.sh | 46 ++++++++++++++++ .../scripts/archival/euphrosyne_comparator.sh | 54 +------------------ 3 files changed, 63 insertions(+), 53 deletions(-) create mode 100644 scripts/archival/comparator.sh diff --git a/scripts/archival/comparator.sh b/scripts/archival/comparator.sh new file mode 100644 index 00000000..236cc2c5 --- /dev/null +++ b/scripts/archival/comparator.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# compares this machine's local archives against an exemplar set. + +target="$1"; shift + +if [ -z "$target" ]; then + target=wildmutt + #target=curie +fi + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/archival/general_updater.sh" + +uber_archive_comparator $target + diff --git a/scripts/archival/general_updater.sh b/scripts/archival/general_updater.sh index 084e26c3..7dac5777 100644 --- a/scripts/archival/general_updater.sh +++ b/scripts/archival/general_updater.sh @@ -98,6 +98,52 @@ function update_archive_drive() popd } +# compares one local well-known folder against the similar folder on a +# remote destination. +function do_a_folder_compare() +{ + local archname="$1"; shift + local dest="$1"; shift + if [ -z "$archname" -o -z "$dest" ]; then + echo "do_a_folder_compare needs an archive name and a destination host." + return 1 + fi + + if [ -d "/z/$archname" ]; then + sep 14 + echo "Comparing $archname folder..." + compare_dirs /z/${archname} ${dest}:/z/${archname} + sep 14 + fi +} + +# 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. +function uber_archive_comparator() +{ + local target="$1"; shift + if [ -z "$target" ]; then + echo uber_archive_comparator needs the target host to compare with. + return 1 + fi + + sep 14 + echo "comparing against host '$target'" + 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 $target + done +} + + #hmmm: abstractable piece? the runtime plug at the end of a library script? # this block should execute when the script is actually run, rather # than when it's just being sourced. diff --git a/scripts/customize/fred/scripts/archival/euphrosyne_comparator.sh b/scripts/customize/fred/scripts/archival/euphrosyne_comparator.sh index 4433e0e2..32980c42 100644 --- a/scripts/customize/fred/scripts/archival/euphrosyne_comparator.sh +++ b/scripts/customize/fred/scripts/archival/euphrosyne_comparator.sh @@ -1,58 +1,6 @@ #!/bin/bash -# 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. - -target="$1"; shift - -if [ -z "$target" ]; then - target=wildmutt - #target=curie -fi - source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +source "$FEISTY_MEOW_SCRIPTS/archival/comparator.sh" -function do_a_folder_compare() -{ - local archname="$1"; shift - local dest="$1"; shift -#hmmm: error checking? - - if [ -d "/z/$archname" ]; then - sep 14 - echo "Comparing $archname folder..." - compare_dirs /z/${archname} ${dest}:/z/${archname} - sep 14 - fi -} - -for archicle in \ - basement \ - imaginations \ - musix \ - toaster \ - walrus \ -; do - do_a_folder_compare $archicle $target -done -#cruft: -#sep 14 -#echo "Comparing basement folder..." -#compare_dirs /z/basement ${target}:/z/basement -#sep 14 -# -#sep 14 -#echo "Comparing imaginations folder..." -#compare_dirs /z/imaginations ${target}:/z/imaginations -#sep 14 -# -#sep 14 -#echo "Comparing musix folder..." -#compare_dirs /z/musix ${target}:/z/musix -#sep 14 -# -#sep 14 -#echo "Comparing walrus folder..." -#compare_dirs /z/walrus ${target}:/z/walrus -#sep 14 -- 2.34.1