1 #!/usr/bin/env nix-shell
2 #!nix-shell --packages curl
3 #!nix-shell --packages jq
4 #!nix-shell --packages parallel
7 # Exit immediately if a command exits with a non-zero status.
8 # Exit when a producer fails in a pipe
9 # Treat undefined variable references as errors
12 # Check if working directory is (probably) right
13 test "./update" = $0 || {
14 echo "The working directory ought to be the same is the update script location. Please invoke as ./update" 1>&2
18 # Create temporary directory with automatic cleanup
19 readonly MY_TMP="$(mktemp -d)"
25 # stdout: file containing release info and a convenient placeholder
26 # for the sha256 attribute
30 local out="$MY_TMP/$owner--$repo-release"
31 curl -fSs https://api.github.com/repos/"$owner"/"$repo"/releases/latest \
32 | jq '{ version: .name, url: .tarball_url, sha256: "__SHA256__" }' \
37 # 'getters' for the release info file
39 # stdout: unquoted tarball url
45 # stdout: unquoted version
48 jq -r '.version' <"$file"
51 # Fetch release tarball and compute hash
52 # stdout: base32 sha256 to be used in fetchurl
56 nix-prefetch-url "$(releaseUrl "$file")" --name "$name-$(releaseVersion "$file").tar.gz"
59 # Write a release info file to release-info/$owner-$repo.json
63 local r="$(getRelease "$owner" "$repo")"
64 local hash="$(getReleaseHash "$r" "$repo")"
66 -e s/__SHA256__/"$hash"/\
68 >"release-info/$owner-$repo.json"
71 updateRelease LanguageMachines frogdata
72 updateRelease LanguageMachines frog
73 updateRelease LanguageMachines libfolia
74 updateRelease LanguageMachines mbt
75 updateRelease LanguageMachines ticcutils
76 updateRelease LanguageMachines timbl
77 updateRelease LanguageMachines timblserver
78 updateRelease LanguageMachines ucto
79 updateRelease LanguageMachines uctodata