WeAreFairphone / flashable-zip_microG

Install microG or UnifiedNlp into an Android system, plus an OTA survival addon.d script
https://github.com/WeAreFairphone/flashable-zip_microG/releases
GNU General Public License v3.0
28 stars 6 forks source link

microG flashable ZIP #1

Closed Roboe closed 7 years ago

Roboe commented 7 years ago

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
Roboe commented 7 years ago

Done! https://github.com/WeAreFairphone/flashable-zip_microG/releases/tag/2017-06-02