Skip to content

Commit

Permalink
Created script to update checksums in bulk
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Edgin committed Mar 22, 2024
1 parent b732dd0 commit a500a8c
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions chksum
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env bash

show_help() {
cat <<EOF
$EXEC_NAME version $VERSION
Usage:
$EXEC_NAME
$EXEC_NAME (-h|--help)
$EXEC_NAME (-v|--version)
Updates the checksums stored in the iRODS catalog.
This script updates the checksum values stored in the iRODS catalog for a set of
data objects. Each replica of each data object is updated. It reads the list of
data objects from stdin with each data object being on its own line.
Options:
-h, --help show help and exit
-v, --version show version and exit
Prerequisites:
1) iRODS iCommands version 4.2.8+ must be installed.
2) The user must be initialized with iRODS as an admin user.
© 2024, The Arizona Board of Regents on behalf of The University of Arizona. For
license information, see https://cyverse.org/license.
EOF
}

set -o errexit -o nounset -o pipefail

readonly VERSION=1

EXEC_NAME="$(basename "$(realpath --canonicalize-missing "$0")")"
readonly EXEC_NAME

main() {
local opts
if ! opts="$(getopt --name="$EXEC_NAME" --options=hv --longoptions=help,version -- "$@")"; then
printf '\n' >&2
show_help >&2
return 1
fi

eval set -- "$opts"

while true; do
case "$1" in
-h|--help)
show_help
return 0
;;
-v|--version)
printf '%s\n' "$VERSION"
return 0
;;
--)
shift
break
;;
*)
show_help >&2
return 1
;;
esac
done

xargs --delimiter='\n' ichksum -a -f -M -v
}

main "$@"

0 comments on commit a500a8c

Please sign in to comment.