Skip to content

Generate a complete APT/YUM repository for GitHub Desktop with automatic updates.

License

Notifications You must be signed in to change notification settings

mwt/desktop-makerepo

Repository files navigation

Generate repo for Rclone

This repository contains scripts that generate APT and YUM repositories for Rclone. It is designed to be run at regular intervals using a cron job. However, it can also be run via webhook when new packages are released. The repository consists of three main scripts.

  1. The first setup script, initial-setup/1-install-packages.sh, installs the required packages. It requires sudo access and should be run only once.
  2. The second setup script, initial-setup/2-enviroment.zsh, sets up the directory structure and dynamic configuration files. It can be run by an unprivileged user. It should be run directly only once.
  3. The main script, build.zsh, generates the APT repo in dist/deb using reprepro and generates the YUM repo in dist/rpm using createrepo-c. It should be rerun regularly to add updated packages to the repository.

Because the first script installs packages with APT, it only works on Debian and its derivatives. I have tested it on Debian and Ubuntu.

Running those three scripts should get you a working installation. The two setup scripts, initial-setup/1-install-packages.sh and initial-setup/2-enviroment.zsh are split apart for two reasons. The first is that the installation script requires superuser access. So, it is reasonable to have the two scripts run by different users. The second is that the environment script has to be run anytime that the user cleans the repository (eg. using git clean -dfx). The clean.zsh script automates this process.

Usage

There is a minimal example using this with GitHub actions here. This example can be easily extended to any Debian based CI. First, you must install or generate a GPG key. Then you need to download and extract the latest release. After this, you can run the following inside the folder:

./initial-setup/1-install-packages.sh
./initial-setup/2-enviroment.zsh "$GPG_FINGERPRINT"

This installs all the dependencies and sets up the directory structure. After this, you an build the repositories:

./build.zsh

Using for Other Projects

To make this work for other projects, you need to edit reprepro/conf/distributions as well as the REPO_LATEST_API variable in build.zsh. The SignWith GPG key defined in the reprepro distributions file is also used to sign the YUM repository.

Dependencies

This script is written in zsh, a popular alternative to bash. This script directly runs the following commands.

Basic dependencies:

  • sed is used to read the GPG key id from a configuration file.
  • GPG is used to sign the repos.
  • Wget downloads json and packages.
  • jq is used to process json files.

APT repos:

  • A fork of reprepro makes the APT repo. The fork supports multiple versions of the same package in a repo.

YUM repos:

  • RPM is used to get the version info and architecture of RPM packages for renaming.
  • createrepo-c is used to make repo metadata for the YUM repo.

Releases

No releases published

Packages

No packages published

Languages