anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / networking / instant-messengers / signal-desktop / update.sh
blob1c5f2386da2935710f8850cbfe3c5493663699f9
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p bash nix-update curl coreutils jq
4 set -ex
6 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
8 curl_github() {
9 curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "$@"
12 case "$UPDATE_NIX_ATTR_PATH" in
13 signal-desktop)
14 latestTag=$(curl_github https://api.github.com/repos/signalapp/Signal-Desktop/releases/latest | jq -r ".tag_name")
15 latestVersion="$(expr "$latestTag" : 'v\(.*\)')"
16 latestVersionAarch64=$(curl_github "https://api.github.com/repos/0mniteck/Signal-Desktop-Mobian/releases/latest" | jq -r ".tag_name")
18 echo "Updating signal-desktop for x86_64-linux"
19 nix-update --version "$latestVersion" \
20 --system x86_64-linux \
21 --override-filename "$SCRIPT_DIR/signal-desktop.nix" \
22 signal-desktop
24 echo "Updating signal-desktop for aarch64-linux"
25 nix-update --version "$latestVersionAarch64" \
26 --system aarch64-linux \
27 --override-filename "$SCRIPT_DIR/signal-desktop-aarch64.nix" \
28 signal-desktop
30 echo "Updating signal-desktop for darwin"
31 nix-update --version "$latestVersion" \
32 --system aarch64-darwin \
33 --override-filename "$SCRIPT_DIR/signal-desktop-darwin.nix" \
34 signal-desktop
36 signal-desktop-beta)
37 latestTagBeta=$(curl_github https://api.github.com/repos/signalapp/Signal-Desktop/releases | jq -r ".[0].tag_name")
38 latestVersionBeta="$(expr "$latestTagBeta" : 'v\(.*\)')"
39 echo "Updating signal-desktop-beta for x86_64-linux"
40 nix-update --version "$latestVersionBeta" --system x86_64-linux --override-filename "$SCRIPT_DIR/signal-desktop-beta.nix" signal-desktop-beta
43 echo "Unknown attr path $UPDATE_NIX_ATTR_PATH"
45 esac