A self-hosted F-Droid repository and APK catalog
androidf-droidfdroidserverapkcatalogsystemd-timer
An F-Droid repository is just a directory of APKs plus a signed index that the F-Droid client polls. Hosting one gives every sideloaded app update notifications through a single client, and the same index can drive a plain web catalog page. Justin's lives at https://apps.jhampton.io (catalog) and https://apps.jhampton.io/fdroid/repo (repo); source ~/dev/apps.
How it is built (pull model)
Nothing in the individual apps' deploy scripts knows about the catalog. Instead:
1. update.sh rsyncs each app's live APK from wherever its own deploy put it on the server (list in apps.tsv) into repo/<package>_<versionCode>.apk.
2. fdroid update (fdroidserver 2.4.5 in a Python venv) rebuilds and signs the index.
3. A small script renders the catalog page from that same index.
4. rsync the repo and page back to the server's docroot.
A systemd user timer runs it every 15 minutes and exits early when no APK changed; run it by hand after a deploy for instant publishing, or with --force after metadata/page changes. Each app also gets a stable "newest build" URL, /<slug>.apk, as a symlink into the repo. Keeping two versions per app costs a few hundred MB.
Adding the repo on a phone
Share the repo URL plus its signing-key fingerprint, ideally as an fdroidrepos:// link or QR code on the catalog page. The client pins the fingerprint.
The repo signing key
keystore.p12 + config.yml (both gitignored) sign the index. Losing them means every phone must remove and re-add the repo. Keep a server-side backup (here /home/justin/backups/apps-fdroid-signing/). Check an index signature with jarsigner -verify.
Gotchas
- fdroidserver could not extract icons from these APKs (R8-shrunk resource paths, XML-only adaptive icons). Check icons in at
metadata/<package>/en-US/icon.png; render vector-XML launcher icons to PNG with cairosvg. - Concurrent runs and false deploy failures.
update.shholds a lock (flock) so the 15-minute timer and a deploy's own call never publish at once. When an app's deploy script calls it while the timer holds the lock, the call exits with "another update is running" and the deploy's post-check ("live index does not serve this build") reports failure, yet the timer run that held the lock usually publishes the new APK a minute later. Before redeploying, wait for the lock (flock ~/dev/apps/.lock true) and re-check the served sha256 and the index. Better: make the deploy wait on the lock instead of failing. This happened to three different apps in October 2026. - The F-Droid index doubles as each app's update feed. Apps published only through the catalog (Phone, Files, Map, Calculator, Tokay) have no version file of their own; their self-updaters read
index-v1.json, find their package, and compare versionCodes. One less file to keep in sync, and the index is already signed by the repo key. - Per-version release notes: fdroidserver fills an app's
localized.<locale>.whatsNewin the index frommetadata/<package>/en-US/changelogs/<versionCode>.txt, for the newest build only. An app's deploy script can write that file before running the update, then check the live index for the field; commit the file in the catalog repo afterward. - Rendering icons for one app can touch the others. The catalog's icon-sync script re-encodes every app's checked-in icon, so a run for a new app showed diffs in four unrelated icons. Revert those and commit only the new app's.
- An app that always ships versionCode 1 never shows an update in F-Droid (the stable URL still serves the newest build).
- The catalog surfaced other problems worth fixing in the apps: release APKs signed with the debug key, a default Flutter launcher icon, a
com.example.*package id. See Android app signing keys and why losing one is permanent. - Subdomains need DNS records before launch; a headless session cannot create Linode DNS records, so the catalog first launched under a path on the bare domain and later moved (old paths 301 to the new host).
See also
Linked from
- A keyless maps app on Android (MapLibre + OpenStreetMap services)
- An Android file manager, photo bursts, and cropping
- Android app signing keys and why losing one is permanent
- Android TV / Google TV apps (Compose for TV, Media3, sideloading)
- Building an Android browser on GeckoView (Tokay)
- In-app updates for sideloaded Android apps
- jhampton.io: one home domain, an index, and a wildcard certificate
- Keeping a web app and an Android app identical without a framework
- Keyboard, Justin's Android input method (overview and canon)