Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/configs/releng/airootfs/usr/local/bin/choose-mirror
blob: d2349de472ae2f32cedc53ca3b363105ac03b1b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later

get_cmdline() {
    local param
    for param in $(</proc/cmdline); do
        case "${param}" in
            "${1}="*)
                echo "${param##*=}"
                return 0
                ;;
        esac
    done
}

mirror="$(get_cmdline mirror)"
[[ "$mirror" == 'auto' ]] && mirror="$(get_cmdline archiso_http_srv)"
[[ -n "$mirror" ]] || exit 0

mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
cat >/etc/pacman.d/mirrorlist <<EOF
#
# Arch Linux repository mirrorlist
# Generated by archiso
#

Server = ${mirror%%/}/\$repo/os/\$arch
EOF