Bye bye Play Store! Mirroring Play Store Apks to private F-Droid repo

This small tutorial will show you how to setup your own F-Droid repository containing automatically mirrored Play Store apps. Using this private repo, you don’t have to relay on Google Play Store or third party stores anymore to keep non-free apps up-to-date. All you need to have is a Linux server with a public web server configured :)

Setup

I’m using the Archlinux operating system in my example setup. It should also work on other Linux systems but might require some additional steps.

First, we have to enable the multilib-repository in Pacman for some installation dependencies later:

[...]
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist

[multilib]
Include = /etc/pacman.d/mirrorlist

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
[...]

I’m using the AUR helper aurutils to optain the Android-, Fdroid and Google Play tools. After that, I create the fdroid directory inside the public www directory and initialize it:

aur sync -c fdroidserver android-sdk android-sdk-build-tools gplaycli
pacman -Sy fdroidserver android-sdk android-sdk-build-tools gplaycli
mkdir -p www/fdroid
cd www/fdroid
env ANDROID_HOME=/opt/android-sdk fdroid init

Edit the config.py file to customize the repository info:

[...]
repo_url = "https://example.com/fdroid/repo"
repo_name = "Project-Insanity F-Droid repo"
repo_icon = "fdroid-icon.png"
repo_description = "This is a private F-Droid repository for the PI-crew :)"
[...]

Now we can create the configuration for the Google Play client. Put the app ids of the apps you want to mirror inside the apk.list file. You’ll find these ids by looking it up in the address bar of your browser for the specific app page on play.google.com.

mkdir ~/.config/gplaycli
[Credentials]
token=True
token_url=https://matlink.fr/token/email/gsfid

[Cache]
token=~/.cache/gplaycli/token
org.thoughtcrime.securesms
de.nextbike
com.spotify.music
com.mobiledirection.GPSRepairFix
com.melodis.midomiMusicIdentifier.freemium
com.whatsapp
de.hafas.android.db
de.regiorad.stuttgart
com.ebay.mobile
com.ebay.kleinanzeigen

In my setup, I will run the systemd timer inside a user session (replace the username onny and the repo path in the example below). You don’t have to do this like this and can use system wide timers or cron jobs instead.

[Unit]
Description=Gplaycli automatic APK mirror
After=network-online.target 

[Service]
Type=simple
ExecStart=/usr/bin/sh -c "/usr/bin/gplaycli -v -dc oneplus3 --file /home/onny/.config/gplaycli/apk.list --folder /home/onny/www/fdroid/repo/ && cd /home/onny/www/fdroid && env ANDROID_HOME=/opt/android-sdk fdroid update --create-metadata"
TimeoutStopSec=180
KillMode=process
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target
[Unit]
Description=Gplaycli automatic APK mirror

[Timer]
OnBootSec=5min
OnUnitActiveSec=12h
Unit=gplaycli.service

[Install]
WantedBy=multi-user.target

After enabling this timer, the script will refetch the apks and update the repo every 12 hours :)

systemctl --user --now enable gplaycli.timer
loginctl enable-linger piradio

Go to the settings page of your F-Droid client and add the custom repository. The url might look like https://example.com/fdroid/repo:

This still requires the play store, so you haven’t eliminated a dependency and have added another point of failure.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

* Checkbox GDPR is required

*

I agree

Software
Ebook reader app for Nextcloud

Because of lack of altenatives I decided to write a small ebook reader plugin for Nextcloud. The task of creating such an app was quite easy: I just forked the files_pdfviewer extension and replaced PDF.js with the Epub.js library. In the app template file, I used the reference ebook reader …

Software
Hacking replay gain audio normalization into Jellyfin

There is already a feature request for audio normalization in Jellyfin media server. This is important if you want to listen to your music collection while always having the same loudness level. Usually, in different recordings or music genres some tracks are louder and others are more quiet. The standard …

Software
Importing playlists to Jellyfin media server

In the following post I would like to describe a way to import music playlists to Jellyfin media server, for example in case you want to migrate them from a former Plex or Emby installation. Usually, Jellyfin is already able to detect playlist files within the media library. Unfortunately my …