Skip to content

Instantly share code, notes, and snippets.

@obfusk
Last active December 9, 2022 03:02
Show Gist options
  • Select an option

  • Save obfusk/ab5a3c65315a43166e3436ad1f367501 to your computer and use it in GitHub Desktop.

Select an option

Save obfusk/ab5a3c65315a43166e3436ad1f367501 to your computer and use it in GitHub Desktop.
-> https://github.com/obfusk/fdroid-misc-scripts | download & check f-droid APKs using Binaries:
#!/bin/bash
set -e
for yml in $( grep -l ^Binaries: fdroiddata/metadata/*.yml | sort ); do
echo "==> $yml"
base="$(basename "$yml" .yml)"
read -r version code upstream_url < <( python3 -c '
import sys, yaml
with open(sys.argv[1]) as fh:
m = yaml.safe_load(fh.read())
for b in reversed(m["Builds"]):
if not "disable" in b:
v = b["versionName"]
c = b["versionCode"]
print(v, c, m["Binaries"].replace("%v", v).replace("%c", str(c)))
break
else:
print()
' "$yml" )
if [ -z "$version" -o -z "$code" ]; then
echo 'all versions disabled'
else
echo "version=$version code=$code"
upstream="binaries/${base}_${code}_upstream.apk"
fdroid="binaries/${base}_${code}_fdroid.apk"
fdroid_url="https://f-droid.org/repo/${base}_${code}.apk"
[ -e "$upstream" ] || wget -O "$upstream" -- "$upstream_url" \
|| { echo 'not found upstream'; rm "$upstream"; }
[ -e "$fdroid" ] || wget -O "$fdroid" -- "$fdroid_url" \
|| { echo 'not found in f-droid'; rm "$fdroid"; }
fi
echo
done
#!/bin/bash
if [ $# = 0 ]; then
compare=( apksigcopier compare )
else
compare=( "$@" )
fi
for apk in $( ls | sed -r 's/_(fdroid|upstream)\.apk$//' | sort | uniq ); do
[ -e "${apk}_upstream.apk" -a -e "${apk}_fdroid.apk" ] && echo "$apk" \
&& ( "${compare[@]}" "${apk}_upstream.apk" "${apk}_fdroid.apk" || echo FAILED >&2 )
done
#!/bin/bash
for apk in *.apk; do
test "$( apksigtool parse-v1 --json "$apk" 2>/dev/null | jq -r .manifest.built_by )" \
= Signflinger && echo "$apk"
done
#!/bin/bash
zfe_sha1=7170680469ab42a97fe39d10011c5b72971a57a4
for apk in *.apk; do
test "$( head -c28 "$apk" | shasum | cut -c-40 )" = "$zfe_sha1" && echo "$apk"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment