WeAreFairphone/flashable-zip_microG

microG flashable ZIP

Roboe opened this issue · 1 comments

Roboe commented

Moved from WeAreFairphone/flashable-zips#1

@Roboe, 21 jun. 2017 20:14 CEST:

This is just an idea I think about sometimes. A flashable ZIP to integrate @microg apps into the system, for those AOSP-based OSes that refuse to apply the required patches.

What the ZIP should do:

  1. Install official APKs from microg.org to /system/app, or /system/priv-app whether necessary.
  2. Install at least one ready-to-use UnifiedNLP backend to userspace, maybe MozillaNlpBackend and NominatimGeocoderBackend (APKs from F-Droid)
  3. Install an OTA survival script (addon.d), like:

I can't find docs about addon.d backup (bulletpoint 3). Help needed with this. The script is well-documented in its first commit (it's just a script with life-cycle methods to implement), and LineageOS 50-cm.sh script is a reference implementation.

P.S.: Signature spoofing is not included because it seems to be hard to achieve from inside the phone.

@Roboe, 25 jun. 2017 20:19 CEST:

I've been doing some research for how to retrieve official APKs from microG's F-Droid repo:

  • F-Droid repo URL is: https://microg.org/fdroid/repo/
  • Repo index is a XML file located here: https://microg.org/fdroid/repo/index.xml
  • Root XML tag is fdroid and have an application tag child for each app.
  • application has a child marketvercode whose value equals the latest stable release for the app (which IMHO should be the one we should install).
  • application has multiple package childs, one per version.
  • package has a child versioncode with the version code value.
  • package has a child apkname with the full name of the APK file (which follows the pattern <appid>-<versioncode>.apk)
  • Appending the apkname value to the repo URL we get the download URL for each app.

This could be automated in a bash script, I need to figure a way to easily parse XML (XPath?) without dependencies, ideally

Edit:
With python-lxml (Bash wrapper, kinda verbose, but preinstalled on most GNU/Linux distros):

python2 -c "from lxml.etree import parse; from sys import stdin; print '\n'.join(parse(stdin).xpath('/fdroid/application/@id'))" < index.xml

With xmlstarlet:

$ VERSION_CODE=$(xmlstarlet select -t -v "/fdroid/application[@id = 'com.google.android.gms']/marketvercode" index.xml)
$ xmlstarlet select -t -v "/fdroid/application[@id = 'com.google.android.gms']/package[versioncode = '$VERSION_CODE']/apkname" index.xml
com.google.android.gms-9258259.apk