archinstall icon indicating copy to clipboard operation
archinstall copied to clipboard

Introduce '--mirrors' cmd line option which allows the user to add custom repositories/mirrors

Open Tereius opened this issue 3 years ago • 0 comments
trafficstars

With the cmd line option --mirrors user-defined repositories/mirrors can be made available during/after installation (might close #814). Following format is expected:

archinstall --mirrors <REPO_NAME>,<INDEX>@<REPO_URL>

This will create a new repo section in /etc/pacman.conf right at the beginning of the guided installer. The new section looks like this:

[<REPO_NAME>]
SigLevel = Optional TrustAll
Server = <REPO_URL>

The <INDEX> determines the position in pacman.conf (an index of zero will place it right at the top). The new add_custom_repository() function in mirrors.py is used for this.

Because the guided installer now changes the pacman.conf on the host system, I added a new Context Manager PacmanConfBackup in pacman.py that does a backup of the original pacman.conf file. If the Context Manager goes out of scope the backup is restored.

In find_package() in packages.py I had to replace package_search() with the new function pacman_package_search() which searches for packages via pacman -Ss instead of http search requests. This is necessary because custom repositories may contain packages not found in the official Arch repos.

In installation.minimal_installation() I added an argument to copy over the /etc/pacman.conf to the target system. The guided installer always copies the pacman.conf file over if the --mirrors argument was provided.

Tereius avatar Jun 07 '22 23:06 Tereius