Last active
August 20, 2021 14:02
-
-
Save obfusk/516e779a513239959302b9da33354ad7 to your computer and use it in GitHub Desktop.
download latest signal APK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| yaml2json() { | |
| python3 -c 'import json, sys, yaml; json.dump(yaml.safe_load(sys.stdin), sys.stdout)' | |
| } | |
| json="$( curl https://updates.signal.org/android/latest.json )" | |
| meta=org.thoughtcrime.securesms.yml | |
| cur_vsn="$( yaml2json < "$meta" | jq -r .CurrentVersionCode )" | |
| lat_vsn="$( printf '%s' "$json" | jq -r .versionCode )" | |
| lat_url="$( printf '%s' "$json" | jq -r .url )" | |
| lat_sha="$( printf '%s' "$json" | jq -r .sha256sum )" | |
| echo "current versionCode: $cur_vsn" | |
| echo "latest versionCode: $lat_vsn" | |
| file="${lat_url##*/}" | |
| if [ ! -e "$file" ]; then | |
| vsn="$( printf '%s' "$json" | jq -r .versionName | tr -cd 0-9. )" | |
| if [ "$file" != "Signal-Android-website-prod-universal-release-$vsn.apk" ]; then | |
| echo "unexpected file name: $file" >&2 | |
| exit 1 | |
| fi | |
| echo "downloading $file..." | |
| wget -O "$file" -- "$lat_url" | |
| printf '%s %s' "$lat_sha" "$file" | sha256sum -c | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment