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 User=onny ExecStart=/usr/bin/sh -c "rm -f /home/onny/.cache/gplaycli/token && /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 daemon-reload systemctl --now enable gplaycli.timer

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: