summaryrefslogtreecommitdiff
path: root/configs/talkingparabola/airootfs/usr/local/bin/choose-mirror
blob: e8f82546191ec2934e34e7f6281f5848f7a934de (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 parabolaiso_http_srv)
[[ $mirror ]] || exit 0

mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
cat >/etc/pacman.d/mirrorlist << EOF
#
# Parabola GNU/Linux-libre repository mirrorlist
# Generated by parabolaiso
#

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