Pamac only supports one country - but you can do it with pacman-mirrors
pacman-mirrors -h
or read the man page
man pacman-mirrors
The end result is a what is called a custom mirror pool and any and all subsequent runs of pacman-mirrors will work only on that pool. The mirror pool can be reset using the -c all argument.
List all mirror countries in alphabetical order (no - there is no option to list countries in continent)
pacman-mirrors -l
Then build a command using the your preferred countries.
Or you can use the -c all --interactive --default
sudo pacman-mirrors --country all --interactive --default [--no-status]
Select the countries to include and save the choices.
In case you wonder why only certain countries are represented in the final mirrorlist - you must know that - any run of pacman-mirrors will only return mirrors registered as up-to-date for the current system branch.
It is possible to use the –no-status flag thus including mirrors which has not synced for a very long time. As some mirrors has not synced for months - the result should be limited by using the –interval Y where Y is the number of hours since last sync. Don’t use this feature unless you have very compelling reasons to do so.
To practice my python - I wrote below snippet. The snippet prints out the countries for your continent and adds the Global to the list (I have noted another non-existing country MENA)
import requests
from pacman_mirrors.constants.timezones import countries
# preload countries list with Global mirror
result = ["Global"]
# setup requests
mirror_data_request = requests.get("https://repo.manjaro.org/mirrors.json")
geo_info_request = requests.get("https://get.geojs.io/v1/ip/geo.json")
continent_codes_request = requests.get("https://datahub.io/core/continent-codes/r/continent-codes.json")
# fetch data using the requests
manjaro_mirror_data = mirror_data_request.json()
geo_info_data = geo_info_request.json()
continent_codes_data = continent_codes_request.json()
# setting up filter expressions
continent_data_expression = [cc for cc in continent_codes_data if geo_info_data["continent_code"] in cc["Code"]]
continent_country_expression = [c for c in countries if c["continent"] == continent_data_expression[0]["Name"]]
# loop the countries
for country in continent_country_expression:
# setup mirror filter expression
mirror_country_expression = [m for m in manjaro_mirror_data if m["country"] == country["name"].replace(" ", "_")]
# loop the mirrors
for mirror in mirror_country_expression:
# check for duplicates
if mirror["country"] not in result:
result.append(mirror["country"])
# skip the remaining mirrors in country
continue
print(",".join(result))
Assuming the above snippet is saved in your home as main.py then running the snippet will - for a european citizen - produce the following result
$ ~ python main.py
Global,Iceland,Netherlands,Greece,Germany,Belgium,Hungary,Denmark,Finland,Russia,Ukraine,Portugal,United_Kingdom,Spain,Belarus,Norway,France,Italy,Bulgaria,Sweden,Austria,Poland,Switzerland
It is possible to run the script and feed the output to pacman-mirrors like this
$ ~ sudo pacman-mirrors -c $(python main.py)