3 #=======================================================================
5 # File ID: 027211a6-f115-11e4-9e02-000df06acc56
7 # Generate SHA256 sums, use the same format as SHA256 keys in git-annex.
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
27 " -n "$progname" -- "$@
")"
28 test "$?" = "0" ||
exit 1
37 -f|
--filename) opt_filename
=1; shift ;;
38 -h|
--help) opt_help
=1; shift ;;
39 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
40 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
41 --version) echo $progname $VERSION; exit 0 ;;
43 *) echo $progname: Internal error
>&2; exit 1 ;;
46 opt_verbose
=$
(($opt_verbose - $opt_quiet))
48 if test "$opt_help" = "1"; then
49 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
52 Generate SHA256 sums, use the format used by the "SHA256" backend in
55 Usage: $progname [options] FILE [FILE ...]
60 Include filenames in output.
64 Be more quiet. Can be repeated to increase silence.
66 Increase level of verbosity. Can be repeated.
68 Print version information.
74 test -z "$1" && { echo $progname: Missing filename
>&2; exit 1; }
77 if test ! -f "$file"; then
78 test $opt_verbose -ge 0 && echo $progname: $file: Ignoring non-file
>&2
81 if test "$opt_filename" = "1"; then
87 wc -c "$file" | cut
-f 1 -d ' '
88 )--$
(sha256sum
"$file" |
head -c 64)$fname_str