From d9d087c2d3ed5c8514a22f5c9a8ac5c555759007 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Wed, 29 Mar 2023 06:49:07 +0000 Subject: [PATCH] Add more logging to uploader --- codearchiver-bot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/codearchiver-bot b/codearchiver-bot index dd2d61d..e92013a 100755 --- a/codearchiver-bot +++ b/codearchiver-bot @@ -212,6 +212,8 @@ function respond { continue fi + log 'Starting upload batch' + # Record SHA-256 hashes for new files sha256sum "${filenames[@]}" > >(log_loop 'sha256sum: ') @@ -226,6 +228,7 @@ function respond { fi uploadsfine=y for f in "${filenames[@]}"; do + log "Uploading $(printf '%q' "${f}") to ${identifier}" ia-upload-stream --no-derive "${identifier}" "${f}" \ "collection:${collection}" \ 'mediatype:software' \ @@ -242,6 +245,7 @@ function respond { done if [[ -z "${uploadsfine}" ]]; then + log 'At least one upload in the batch failed, not removing anything' continue fi @@ -264,7 +268,7 @@ function respond { touch '.uploaded' for f in "${filenames[@]}"; do if [[ "${f}" != *_codearchiver_metadata.txt ]]; then - log "Replacing ${f} with symlink to .uploaded" + log "Replacing $(printf '%q' "${f}") with symlink to .uploaded" { rm --verbose -- "${f}" && ln --symbolic --verbose '.uploaded' "${f}"; } |& log_loop 'rm/ln: ' fi done