LinuxCommandLibrary

fdroid

Manage apps from the F-Droid repository

TLDR

Build a specific app

$ fdroid build [app_id]
copy

Build a specific app in a build server VM
$ fdroid build [app_id] --server
copy

Publish the app to the local repository
$ fdroid publish [app_id]
copy

Install the app on every connected device
$ fdroid install [app_id]
copy

Check if the metadata is formatted correctly
$ fdroid lint --format [app_id]
copy

Fix the formatting automatically (if possible)
$ fdroid rewritemeta [app_id]
copy

SYNOPSIS

fdroid [OPTIONS] COMMAND [ARGUMENTS...]

Common Commands:
fdroid init [OPTIONS]
fdroid build [OPTIONS] PACKAGE_NAME...
fdroid update [OPTIONS]
fdroid publish [OPTIONS]
fdroid lint [OPTIONS]
fdroid sign [OPTIONS] APK_FILE
fdroid version
fdroid help [COMMAND]

PARAMETERS

--help
    Show program's help message and exit.

--version
    Show program's version number and exit.

--verbose, -v
    Output more information during execution.

--pretty-print
    Pretty print JSON output.

--no-sig-check
    Do not check signatures (use with caution).

--server-dir DIR
    Path to the server directory (default: current directory).

--repo-url URL
    The URL of the repository (required for publishing).

--repo-name NAME
    The name of the repository.

--repo-key KEY_ID
    The GPG key ID to use for signing the repository.

--signer SIGNER
    The signing command to use (e.g., 'jarsigner' or 'apksigner').

--user-agent AGENT
    Set custom user agent for network requests.

--disable-check-updates
    Do not check for new fdroidserver versions.

Specific to build command:
--force-build

    Force a build even if APK exists.

--skip-check-upstream-version
    Do not check upstream for new versions.

--clean
    Clean build directory before building.

--skip-clean
    Do not clean build directory after building.

--tag TAG
    Build a specific Git tag.

--version-code CODE
    Build a specific version code.

--subdir SUBDIR
    Build from a specific subdirectory within the app's source.

Specific to update command:
--all

    Update all apps.

--latest
    Only add the latest version to the repo.

--include-signed-apks
    Include already signed APKs.

Specific to publish command:
--force-publish

    Publish even if repository is not clean.

--json-only
    Only update the JSON index, do not copy APKs.

--zip-only
    Only generate the ZIP file, do not copy APKs or update JSON.

--copy-apks
    Copy APKs to the repository directory.

DESCRIPTION

The fdroid command on Linux is part of the fdroidserver suite, a collection of tools designed for building, managing, and publishing F-Droid application repositories. Unlike the F-Droid client application on Android, this command-line utility empowers developers and organizations to host their own independent F-Droid stores. It automates the process of fetching application source code, compiling it, creating signed APKs, and generating the necessary metadata and index files for an F-Droid repository. Users can define application configurations, manage build recipes, and keep their repositories updated with new versions or patches. It's a crucial component for fostering a decentralized and open-source Android ecosystem, providing an alternative distribution channel to proprietary app stores. This tool is primarily used for creating and maintaining custom F-Droid repositories.

CAVEATS

fdroidserver and the fdroid command require a complex setup, including Java Development Kit (JDK), Python 3, and various build tools (e.g., Android SDK build tools, Git). The configuration for building apps, especially older ones, can be intricate due to varying Android API levels, build systems (Gradle, Ant, Maven), and dependencies. Managing GPG keys for repository signing is critical and requires careful handling. Building apps can be resource-intensive, requiring significant CPU, RAM, and disk space. Errors often arise from environment misconfigurations or issues with upstream source code.

<B>TYPICAL WORKFLOW</B>

The typical workflow for using the fdroid command involves first initializing a repository using fdroid init. Then, app metadata (YML files) are added or updated in the metadata directory. Applications are then built and added to the repository using fdroid build followed by fdroid update to generate the repository index. Finally, fdroid publish is used to copy the APKs and index files to the serving directory. This structured approach ensures all apps are built from source and properly signed before distribution.

<B>CONFIGURATION FILES</B>

The fdroid command heavily relies on configuration files, primarily located within the server directory. These include YML files in the metadata/ directory, which define each application's details and build instructions, and the main config.py file, which contains global repository settings. Understanding and correctly configuring these files is essential for effective use of the fdroid command.

HISTORY

F-Droid was founded in 2010 by Ciaran Gultnieks, aiming to provide a fully free and open-source alternative to proprietary Android app stores. The fdroidserver toolkit, including the fdroid command, emerged as the core technology enabling this vision. It was developed to automate the entire process of building, signing, and publishing applications from their source code, ensuring reproducibility and transparency. The project has consistently focused on user privacy, security, and decentralized distribution, evolving its tools and processes to support a growing ecosystem of independent app developers and repository maintainers. Its development is community-driven and open-source.

SEE ALSO

adb(1): Android Debug Bridge, for interacting with Android devices., git(1): Distributed version control system, crucial for fetching app sources., jarsigner(1): Java tool for signing JAR files, used for APKs., apksigner(1): Android SDK tool for signing APKs., gpg(1): GNU Privacy Guard, for managing cryptographic keys and signing.

Copied to clipboard