Quick Start: Creating a Local Repository

This guide provides a step-by-step tutorial for setting up your first local pacman repository to use with aurutils. This is the fundamental workflow for the entire tool suite.

We will create a repository named custom located in /home/your-user/aur-repo.

1. Configure Pacman

First, you need to tell pacman about your new local repository. You can either edit /etc/pacman.conf directly or, preferably, create a separate configuration file.

Create a new file, for example, /etc/pacman.d/custom-repo:

# /etc/pacman.d/custom-repo
[custom]
SigLevel = Optional TrustAll
Server = file:///home/your-user/aur-repo

Now, include this file in your main /etc/pacman.conf:

# /etc/pacman.conf

# ... other repositories like [core], [extra] ...

Include = /etc/pacman.d/custom-repo

Note: Avoid naming your repository local, as this name is reserved by pacman.

2. Create the Repository Directory and Database

Next, create the directory that will hold your built packages and the repository database.

# Create the directory. Replace 'your-user' with your actual username.
# It's recommended to have the user own this directory.
sudo install -d /home/your-user/aur-repo -o your-user

# Navigate into the directory
cd /home/your-user/aur-repo

# Create an empty repository database file
# The database file must match the repository name: <repo-name>.db.tar.gz
repo-add custom.db.tar.gz

3. Synchronize Pacman

Update pacman's databases to make it aware of your new, empty repository.

sudo pacman -Syu

You should see custom being synchronized in the output.

4. Build and Add Your First Package

Now you're ready to build your first AUR package. A good first package to build is aurutils itself.

aur sync is the high-level command for finding, fetching, and building packages and their dependencies.

# This command will:
# 1. Find 'aurutils' and its dependencies on the AUR.
# 2. Download the source files to a cache directory (~/.cache/aurutils/sync/aurutils).
# 3. Ask you to review the PKGBUILD files.
# 4. Build the package using `aur-build`.
# 5. Add the built package to your 'custom' repository.

aur sync aurutils

During the process, aur-build (called by aur-sync) will automatically use the custom repository because it's the only local repository defined in your pacman.conf.

5. Install the Package with Pacman

After the build is complete, the aurutils package is now in your local repository. You can install it just like any official package.

sudo pacman -S aurutils

Congratulations! You have successfully set up a local repository and built your first AUR package with aurutils. From now on, you can use aur sync to install other AUR packages, and run aur sync -u to update all AUR packages in your local repository.