Hosting Pacman Repositories with Git
aurutils
primarily deals with local file://
repositories, but it's possible to host your pacman repository using Git. This provides several advantages, such as atomic changesets and easy rollbacks.
Advantages
- Atomic Changesets: Each commit can be viewed as a single, consistent set of packages. This allows mirrors to synchronize reliably. Mirrors can perform a shallow clone to reduce bandwidth while maintaining atomicity.
- Changeset-Based Rollbacks: Rolling back to a previous state is as simple as checking out a specific commit hash. This can be specified directly in the
Server
directive inpacman.conf
.
Disadvantages
- Requires Raw File Access: The server hosting the Git repository must provide a way to access raw files directly through a predictable URL structure so that
pacman
can download them.
Hosting Templates
Here are some example Server
URL formats for popular Git hosting platforms. The ${commit:-master}
part allows you to pin the repository to a specific commit or default to the master
/main
branch.
# cgit
Server = https://cgit/$repo.git/plain/
# GitLab
Server = https://gitlab.com/$user/$repo/raw/${commit:-master}/
# Gogs
Server = https://try.gogs.io/$user/$repo/raw/${commit:-master}/
# GitHub
Server = https://raw.githubusercontent.com/$user/$repo/${commit:-master}/
Example: Using GitHub
-
Create a public GitHub repository (e.g.,
my-aur-packages
). -
Clone the repository locally and add your built packages and database files.
git clone https://github.com/your-user/my-aur-packages.git cd my-aur-packages # ...build packages into this directory... repo-add my-aur-packages.db.tar.gz *.pkg.tar.zst
-
Commit and push the changes.
git add . git commit -m "Update packages" git push origin master
-
Configure
pacman.conf
on a client machine to use this repository.[my-aur-packages] SigLevel = PackageOptional Server = https://raw.githubusercontent.com/your-user/my-aur-packages/master
-
Synchronize pacman.
sudo pacman -Syu
Your packages are now available to be installed via pacman -S
from your Git-hosted repository.