changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra > box / airootfs/usr/local/bin/choose-mirror

changeset 2: 2fafbe22bd34
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 31 May 2024 17:30:09 -0400
permissions: -rwxr-xr-x
description: init releng
1 #!/bin/bash
2 #
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 
5 get_cmdline() {
6  local param
7  for param in $(</proc/cmdline); do
8  case "${param}" in
9  "${1}="*)
10  echo "${param##*=}"
11  return 0
12  ;;
13  esac
14  done
15 }
16 
17 mirror="$(get_cmdline mirror)"
18 [[ "$mirror" == 'auto' ]] && mirror="$(get_cmdline archiso_http_srv)"
19 [[ -n "$mirror" ]] || exit 0
20 
21 mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
22 cat >/etc/pacman.d/mirrorlist <<EOF
23 #
24 # Arch Linux repository mirrorlist
25 # Generated by archiso
26 #
27 
28 Server = ${mirror%%/}/\$repo/os/\$arch
29 EOF