diff options
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/verify | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/misc/verify b/misc/verify index 40ef0b4..1af694a 100755 --- a/misc/verify +++ b/misc/verify @@ -7,6 +7,7 @@ RED="\033[0;31m" me="$(basename "$0")" concat="pv -EE -F%r_[%b]_[%t]_[%e]_%p" +crypt=xxh printhelp() { cat << HELPDOC @@ -14,6 +15,7 @@ Usage: $me [options] [file/directory]... OPTIONS: -o, --stdout Output checksum to STDOUT + -d, --compare Output checksum to STDOUT while displaying the progress -S, --supress Supress all warnings and progress notes (default with -o) -n, --no-progress Don't output progress bar (default with -o & -S) -m, --md5 Create/verify md5 checksum @@ -25,20 +27,20 @@ OPTIONS: HELPDOC } -crypt=xxh while true; do case "$1" in - -o|--stdout) stdout=1; nowarn=1; concat="cat" ;; - -S|--supress) nowarn=1; concat="cat" ;; - -n|--no-progressbar) concat="cat" ;; - -m|--md5) crypt=md5 ;; - -s*|--sha*) crypt=sha$(echo "$1" | tr -cd [:digit:]) ;; - -x*|--xxh*) crypt=xxh$(echo "$1" | tr -cd [:digit:]) ;; - -c|--crypt) crypt=$2 && shift ;; # Shift twice - -v|--verify) verify=1 ;; - -h|--help) printhelp; exit 0 ;; - -*) printhelp; exit 2 ;; - *) break ;; + -o|--stdout) stdout=1; nowarn=1; concat="cat" ;; + -d|--compare) stdout=1; nowarn=1; ;; + -S|--supress) nowarn=1; concat="cat" ;; + -n|--no-progressbar) concat="cat" ;; + -m|--md5) crypt=md5 ;; + -s*|--sha*) crypt=sha$(echo "$1" | tr -cd [:digit:]) ;; + -x*|--xxh*) crypt=xxh$(echo "$1" | tr -cd [:digit:]) ;; + -c|--crypt) crypt=$2 && shift ;; # Shift twice + -v|--verify) verify=1 ;; + -h|--help) printhelp; exit 0 ;; + -*) printhelp; exit 2 ;; + *) break ;; esac shift done @@ -52,6 +54,7 @@ if [ ! "$nowarn" ]; then done fi +# TODO Remove trailing / from args while [ -n "$1" ]; do file="$1" [ ! "`echo "$file" | sed "s/.$crypt$//"`" = "$file" ] && shift && continue # Skip hash files |