Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.apk
*.zip
/apk
/dist
/logs
/module-*
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ It requires Magisk to be installed obviously as it's a Magisk module. If you don

0. Use Linux, Mac or WSL on Windows
1. Install `zip`, `curl`, `jq` if not present
2. [Download APKs manually](https://microg.org/download.html) and place in `apk/` directory
2. [Download APKs manually](https://microg.org/download.html) and place in `apk/`
- Or run `scripts/download-apks.sh`
3. Run `scripts/build-noogle-microg.sh`
- Check `-h` flag for help with build options
- Module will be created in `dist/`
Expand Down
Empty file removed apk/.gitkeep
Empty file.
81 changes: 0 additions & 81 deletions scripts/WIP_pull-latest-microg.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/build-noogle-microg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ done

apk_count=$(ls "$apk_dir/com.google.android.gms"* "$apk_dir/com.android.vending"* "$apk_dir/com.google.android.gsf"* 2>/dev/null | wc -l)
if [ "$apk_count" -lt 3 ]; then
echo "[E] Missing one or more required APKs in $apk_dir/, download them from https://microg.org/download.html"
echo "[E] Missing one or more required APKs in $apk_dir/, use ./download-apks.sh to download them or do it manually"
exit 1
elif [ "$apk_count" -gt 3 ]; then
echo "[E] Too many APKs, the $apk_dir/ directory must contain exactly 3 APK files"
Expand Down
46 changes: 46 additions & 0 deletions scripts/download-apks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

repo_url=https://microg.org/fdroid/repo
apk_dir="$(git rev-parse --show-toplevel)/apk"
wait_time=10

mkdir -p "$apk_dir"

curl -fs "$repo_url"/index-v2.json | jq -r '
.packages[] as $pkg | $pkg.versions
| to_entries | sort_by(.value.added) | last.value | [
$pkg.metadata.name["en-US"],
.file.name,
.file.sha256,
.manifest.versionName
] | @tsv
' | while IFS=$(printf '\t') read -r name apk sha256 ver; do
path="$apk_dir$apk"
echo "[I] Latest $name version: $ver"
[ -f "$path" ] && echo "$sha256 $path" | sha256sum -c && {
echo
continue
}

[ "$downloaded" ] && {
echo "[I] Waiting for $wait_time seconds to avoid rate limiting..."
sleep "$wait_time"
}

rm -f "${path%-*}"* # Remove old versions

echo "[I] Downloading $name..."
until curl -sfL "$repo_url$apk" -o "$path"; do
echo "[I] Failed to download $name; retrying in $wait_time seconds..."
sleep "$wait_time"
done
downloaded=1

echo "$sha256 $path" | sha256sum -c || {
echo "[E] Download checksum verification for $path failed! please re-run the script."
exit 1
}
echo
done

echo "[I] All microG APKs are ready!"