4 # ./fetch-language-hashes <tessdataRev> [<language code>…]
6 # Fetches all languages if no language codes are given.
9 # ./fetch-language-hashes 4.0.0 eng spa
17 (( $# >= 1 )) ||
exit 1
24 repoPage
=$
(curl
-fs https
://github.com
/tesseract-ocr
/tessdata
/tree
/$tessdataRev ||
{
25 >&2 echo "Invalid tessdataRev: $tessdataRev"
28 langCodes
=$
(echo $
(echo "$repoPage" |
grep -ohP "(?<=/)[^/ ]+?(?=\.traineddata)" |
sort -u))
31 for lang
in $langCodes; do
32 url
=https
://github.com
/tesseract-ocr
/tessdata
/raw
/$tessdataRev/$lang.traineddata
33 hash=$
(nix
hash to-sri
--type sha256 $
(nix-prefetch-url
$url 2>/dev
/null
))
34 echo "$lang = \"$hash\";"