2026-02-05 20:17:59 +01:00
2023-05-26 12:47:10 +02:00
2023-04-21 10:11:53 +02:00
2026-02-05 20:17:59 +01:00

debrepo

A lightweight command-line tool for managing Debian repositories. It allows you to initialize, maintain, and serve a Debian package repository using standard tools. Alternative to reprepro or aptly.

Why debrepo?

Existing tools like reprepro often limit repositories to a single version of a package, making rollbacks or maintaining historical versions difficult. While aptly is a powerful alternative, it can be complex to configure for smaller use cases.

debrepo was built with simplicity in mind. It uses standard Debian tools (dpkg-scanpackages) to allow multiple versions of the same package to coexist in your repository seamlessly, without the overhead of complex database management.

Dependencies

Ensure the following are installed on your system:

  • bash
  • dpkg-dev (Required for dpkg-scanpackages)
  • gpg (For signing packages)
  • python3 (Optional, for the built-in testing server)

On Ubuntu/Debian:

sudo apt update
sudo apt install dpkg-dev gpg python3

Installation

Clone the repository and create a symlink to your binary path.

git clone https://github.com/filiprojek/debrepo.git
cd debrepo
chmod +x debrepo.sh
# Create a symlink so you can run 'debrepo' from anywhere
sudo ln -s "$(pwd)/debrepo.sh" /usr/bin/debrepo

Getting Started

1. Generate a GPG Key

You must have a GPG key to sign your repository. If you don't have one:

gpg --gen-key

Note the email address you use; you will need it for the configuration.

2. Initialize Repository

Create a directory for your repository and initialize the structure.

mkdir my-archive
cd my-archive
debrepo init --repodir .

3. Configuration

Create configuration file at apt-repo/config.

Example apt-repo/config:

#!/bin/sh

# GPG Key ID for signing (Must match your GPG key email)
DEFAULT_GPG="user@example.com"

# Repository Metadata
ORIGIN="example.com"
LABEL="my-custom-repo"
SUITE="stable"
CODENAME="stable"
ARCHITECTURES="armhf amd64"
COMPONENTS="main"
DESCRIPTION="My custom Debian repository"

4. Add Packages

Add a .deb package to your repository.

debrepo add /path/to/package_1.0_all.deb --repodir ./path/to/repository/

Usage

USAGE:
    debrepo [OPTIONS] [DEB] [--repodir DIR]

OPTIONS:
    init, -i, --init
        Create repository folder structure in the current directory.

    add, -a, --add
        Add a .deb package to the repository pool, update indices, and sign.

    del, -d, --del
        Remove a package from the repository.

    list, -l, --list
        List all packages currently in the repository.

    serve, -s, --serve
        Serve the repository using Python's built-in HTTP server (for testing).

    help, -h, --help
        Print this help message.

    --repodir <DIR>
        Specify the repository root directory.

Hosting

To use this repository in production, point your web server (Nginx, Apache, etc.) to the apt-repo directory generated by the tool.

Server Side: Point http://repo.example.com/ to the apt-repo/ directory.

Client Side: Users can add your repository to their sources:

# 1. Add the public key
curl http://repo.example.com/dists/stable/Release.gpg | sudo apt-key add -

# 2. Add the source
echo "deb http://repo.example.com/ stable main" | sudo tee /etc/apt/sources.list.d/my-repo.list

# 3. Update
sudo apt update

License

Debrepo is a software tool that is licensed under the MIT license. This means that users are free to use, copy, modify, and distribute the tool, both in source code and binary form, as long as they include the original copyright and license notice in any copies or modified versions of the software. The MIT license also comes with no warranty or liability, meaning that the author or contributors of the software cannot be held responsible for any damages or issues that may arise from the use of the software.

Description
Languages
Shell 100%