Add: choose-mirror tool script

This commit is contained in:
Aroy-Art 2024-12-14 22:32:51 +01:00
parent 16a01d1171
commit 7c75140314
Signed by: Aroy
GPG key ID: DB9689E9391DD156

View file

@ -0,0 +1,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