X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Farchival%2Fgeneral_updater.sh;h=baca195c08edf92a36bf3c63db74d6d1450b340c;hb=f25689283bf82e85d442469e61c1c417aa8fab00;hp=7dac5777b1291eacc5b77109fd57a1d2619ce2a0;hpb=f41227cc035ed897f140af2fa73acd517d0d856e;p=feisty_meow.git diff --git a/scripts/archival/general_updater.sh b/scripts/archival/general_updater.sh index 7dac5777..baca195c 100644 --- a/scripts/archival/general_updater.sh +++ b/scripts/archival/general_updater.sh @@ -42,7 +42,7 @@ function synch_directory_to_target() sep if [ ! -d "$from" ]; then - echo "skipping synch on missing source directory: ${from}" + echo "skipping synch on missing source directory: $from" return 0 fi if [ ! -d "$to" ]; then @@ -69,12 +69,12 @@ function update_archive_drive() sep - echo Target drive currently has... - ls "$target_folder" - if [ $? -ne 0 ]; then - echo "The target location '$target_folder' is not mounted currently, so cannot be updated." + if [ ! -d "$target_folder" -a ! -f "$target_folder" ]; then + echo "Target '$target_folder' is not available currently; not updating." return 1 fi + echo Target drive currently has... + dir "$target_folder" # synch all our targets. for currdir in $MAJOR_ARCHIVE_SOURCES; do @@ -99,11 +99,18 @@ function update_archive_drive() } # compares one local well-known folder against the similar folder on a -# remote destination. +# remote destination. the first folder is the archive name, with no paths. +# the second paramter is the local path component of the archive, such as +# "/z" if the archives are found in the /z hierarchy. the third parameter +# is the remote location of the archive, which should just be a host name. +# the fourth parameter is the destination path component to match the local +# path component (since these can differ). function do_a_folder_compare() { local archname="$1"; shift + local pathing="$1"; shift local dest="$1"; shift + local destpath="$1"; shift if [ -z "$archname" -o -z "$dest" ]; then echo "do_a_folder_compare needs an archive name and a destination host." return 1 @@ -111,24 +118,31 @@ function do_a_folder_compare() if [ -d "/z/$archname" ]; then sep 14 - echo "Comparing $archname folder..." - compare_dirs /z/${archname} ${dest}:/z/${archname} + echo "Comparing ${pathing}/${archname} with remote $dest:${destpath}/${archname}" + compare_dirs ${pathing}/${archname} ${dest}:${destpath}/${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. +# 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/). function uber_archive_comparator() { - local target="$1"; shift - if [ -z "$target" ]; then - echo uber_archive_comparator needs the target host to compare with. + local remote_arch="$1"; shift + if [ -z "$remote_arch" ]; then + 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 '$target'" + echo "comparing against host '$remote_arch'" sep 14 #hmmm: shouldn't this be a list in a variable someplace? @@ -139,7 +153,7 @@ function uber_archive_comparator() toaster \ walrus \ ; do - do_a_folder_compare $archicle $target + do_a_folder_compare ${archicle} ${local_place} ${remote_arch} "/z" done }