Add: choose-mirror tool script
This commit is contained in:
parent
16a01d1171
commit
7c75140314
1 changed files with 29 additions and 0 deletions
29
archlive/airootfs/usr/local/bin/choose-mirror
Executable file
29
archlive/airootfs/usr/local/bin/choose-mirror
Executable 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
|
Loading…
Reference in a new issue