From 669b77cc2e0e94cbf64f503624280af1f141a8a5 Mon Sep 17 00:00:00 2001
From: Antoine Fontaine <antoine.fontaine@epfl.ch>
Date: Thu, 18 Jun 2020 13:11:58 +0200
Subject: [PATCH] main/anbox-image: make the workaround to #480 more reliable

The downside of this version is that it will "phone home" with a single
ping to postmarketos.org each time anbox is started. On the other hand,
Android does the same thing with google.com constantly, so well.

This also upgrades the version of FDroid used.
---
 main/anbox-image/APKBUILD      | 12 ++++--------
 main/anbox-image/pma#480.patch |  5 +++--
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/main/anbox-image/APKBUILD b/main/anbox-image/APKBUILD
index 8257535cdb8..0d047b27967 100644
--- a/main/anbox-image/APKBUILD
+++ b/main/anbox-image/APKBUILD
@@ -1,19 +1,15 @@
 # Maintainer: Antoine Fontaine <antoine.fontaine@epfl.ch>
 
-# Preferably we would build our own Android images, but this requires a large amount of storage and hardware:
-# 20G of "sources", that include prebuilt glibc binairies (clang, bison, protobuf!) and may require multilib.
-# So we use pre-built images by Anbox for now.
-
 pkgname=anbox-image
 pkgver=7.1.2_p39
 _pkgver="${pkgver/p/r}"
-pkgrel=3
+pkgrel=4
 pkgdesc="Android image for running in Anbox"
 url="https://anbox.io"
 arch="x86_64 armv7 aarch64"
 makedepends="squashfs-tools"
 license="GPL-3.0-only"
-_fdroidver=1007051
+_fdroidver=1008050
 _fdroid="org.fdroid.fdroid_$_fdroidver.apk"
 _fdroidprivver=2110
 _fdroidpriv="org.fdroid.fdroid.privileged_$_fdroidprivver.apk"
@@ -71,6 +67,6 @@ package() {
 sha512sums="174476153fc5f0f204a8044f32d010e7a22303c7961265976df424c53322969b590d58716a57a2f6b508a90ad645f9bede85e94b85a18790b40cc9b843c66adc  android-7.1.2_r39-anbox_x86_64-userdebug.img
 240d931c68378f80eafa670a19083c5dd11c02f216bec5de955bee3a04063c15830b603a062c83427aa7ad6f4da5425f411147f93815fa67c86cdc850b68a2a1  android-7.1.2_r39-anbox_arm64-userdebug.img
 c0de307cdea7ddc19d5990998cb3f59dac59912a08dacb0d92be09c31bf8f2312d1e02fa8321b950151995120fa9401052b8e97dde620c1739a8314a4470e47d  android-7.1.2_r39.1-anbox_armv7a_neon-userdebug.img
-1b5be16578a86cf5a65591b0c923f791587699b79a50986e68ac290e20e0d252fe57db5a49a0628eb6c66542a6caea76bd382018447fd5ae4d13b54f12b908a7  org.fdroid.fdroid_1007051.apk
+927cbb57b63a1a57e71173c7762c508c42c9ffb4eafdfa2ba7b3713be009d4bee474926546032905d5d7ac2a749d00f2e0651b54d17f148cc3a1ffd2ecdb60ad  org.fdroid.fdroid_1008050.apk
 3c34eb04c96ebee2a1baa06bcf4ebf16915a1fd69143502639998caf34beb744458823705a65617c3bc4e134e5c9fc7fbca4196e1430d7b4d701748fbc29b9dc  org.fdroid.fdroid.privileged_2110.apk
-17926716e13368e5dfc1e46724b1addf7a69b0fa4abd0557333882ef0235d93883e99d33a652806b5c296a00e4391faa3d862fcb5c7a5513e0b2a781c5053968  pma#480.patch"
+81502219939e8e481232f75503dec965b8eb3374befce8574893e860748711c57913945e052c04388282fb00fba7eddce6f2263474f38efee4d7638a3fc5b58e  pma#480.patch"
diff --git a/main/anbox-image/pma#480.patch b/main/anbox-image/pma#480.patch
index e31427d50ce..99116bbbc73 100644
--- a/main/anbox-image/pma#480.patch
+++ b/main/anbox-image/pma#480.patch
@@ -1,12 +1,13 @@
 --- a/anbox-init.sh
 +++ b/anbox-init.sh
-@@ -36,5 +36,11 @@ prepare_filesystem &
+@@ -36,5 +36,12 @@ prepare_filesystem &
  echo "Waiting for filesystem being prepared ..."
  wait $!
  
 +(
-+while ip route add default via 192.168.250.1; do
++while ! ping postmarketos.org -c 1; do
 +	sleep 1
++	ip route add default via 192.168.250.1
 +done
 +) >/dev/null 2>&1 &
 +
-- 
GitLab