diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2021-11-05 22:52:53 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2021-11-05 22:52:53 -0400 |
| commit | 8a86b310630fab17256339fa18f26d8d5c190199 (patch) | |
| tree | 418f07e13f90bbc84f57e628b2caf147bf729170 /airootfs/usr/local/bin/choose-mirror | |
| download | alee-boot-utility-8a86b310630fab17256339fa18f26d8d5c190199.tar.gz alee-boot-utility-8a86b310630fab17256339fa18f26d8d5c190199.tar.bz2 alee-boot-utility-8a86b310630fab17256339fa18f26d8d5c190199.zip | |
Inital commit
Diffstat (limited to 'airootfs/usr/local/bin/choose-mirror')
| -rwxr-xr-x | airootfs/usr/local/bin/choose-mirror | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/airootfs/usr/local/bin/choose-mirror b/airootfs/usr/local/bin/choose-mirror new file mode 100755 index 0000000..b021945 --- /dev/null +++ b/airootfs/usr/local/bin/choose-mirror @@ -0,0 +1,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 |
