Skip to content

Instantly share code, notes, and snippets.

@obfusk
Last active August 20, 2021 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obfusk/516e779a513239959302b9da33354ad7 to your computer and use it in GitHub Desktop.
Save obfusk/516e779a513239959302b9da33354ad7 to your computer and use it in GitHub Desktop.
download latest signal APK
#!/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