Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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