diff --git a/README.md b/README.md index 416960e..eeb0535 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,152 @@ -# Debrepo +# debrepo -A Debian repository management tool. +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. -## About -`Debrepo` is a software tool designed for creating and managing Debian repositories for `*.deb` packages, providing a lightweight and user-friendly alternative to more complex tools like `reprepo` or `aptly`. While these alternatives may offer more advanced features, Debrepo focuses on providing essential functionality and ease of use for repository management, allowing users to easily add, remove, and update packages within their repositories. With Debrepo, users can efficiently manage their Debian repositories without the unnecessary complexity of more advanced tools. +## 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 -`sh` `dpkg` `gpg` `python3` + +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: + +```bash +sudo apt update +sudo apt install dpkg-dev gpg python3 + +``` ## Installation -### from source -- clone this repository to some folder inside your file system -- make symlink to `/bin/` -- now you should be able to use `debrepo` -### from deb package -- *Todo* +Clone the repository and create a symlink to your binary path. + +```bash +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 -## How to use ``` + +## Getting Started + +### 1. Generate a GPG Key + +You must have a GPG key to sign your repository. If you don't have one: + +```bash +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. + +```bash +mkdir my-archive +cd my-archive +debrepo init --repodir . + +``` + +### 3. Configuration + +Create configuration file at `apt-repo/config`. + +**Example `apt-repo/config`:** + +```sh +#!/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. + +```bash +debrepo add /path/to/package_1.0_all.deb --repodir ./path/to/repository/ + +``` + +## Usage + +```text USAGE: - debrepo [OPTIONS] [DEB] + debrepo [OPTIONS] [DEB] [--repodir DIR] OPTIONS: - init, -i, --init - create repository folder structure - add, -a, --add - add deb package to repository - del, -d, --del - delete deb package from repository - list, -l, --list - list deb packages - serve, -s, --serve - serve repository using python built in http module - help, -h, --help - print help message - -v, --version - print version of debrepo package + 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 + 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: + +```bash +# 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 -ARGS: - ... - *.deb package to add or delete from repository. ``` ## 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.