update.sh (554B)
1 #!/usr/bin/env nix-shell 2 #!nix-shell -i bash -p coreutils curl gnused nix-prefetch jq 3 4 set -euo pipefail 5 cd "$(dirname "$0")" 6 7 # The files are updated every Saturday at 6:30 AM (UTC). 8 version=`date -u -d "-$(( $(date -u +%w) + 1 )) days" +%Y-%m-%d` 9 10 sed -i "s/version = \".*\"/version = \"$version\"/" default.nix 11 12 cat tatoeba.json | jq -r '.[]|.url,.hash' | paste - - | while read -r url hash; do 13 newHash=$(nix-prefetch-url --type sha256 $url) 14 sriHash="$(nix hash to-sri --type sha256 $newHash)" 15 sed -i "s#$hash#$sriHash#" tatoeba.json 16 done