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: b021945b9dde8d4cddad77c753017054375e3a9e (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
#!/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)
[[ $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