summaryrefslogtreecommitdiff
path: root/configs/releng/airootfs/etc/systemd/scripts/choose-mirror
blob: 0ae08067cb342aa2728cb6b5af9276e518d94a41 (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
#!/bin/bash

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