Files
computer-playbook/scripts/install/dnf-mirrors.sh
T
kevinveenbirkenbachandClaude Opus 5 535ffd9964 style: delete two Exception comments that only restated the rationale
The policy admits an Exception comment when it names a concrete trip-wire.
Neither of these did.

The compose one argued why the task delegates over query(node_hosts) instead
of guarding on not IS_STACK_HOST; the loop with run_once already says every
node, and the guard it warns about is not in the file to be misread. The
dnf-mirrors one explained why the SIG repository needs its own sed, directly
above a sed whose own path carries SIGs/<stream>/extras/<arch>/extras-common.

Both came from 155b35ec54 and 59840c3362 earlier today. The reasoning stays in
those commit messages, which is where it belongs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-08 09:23:46 +02:00

25 lines
716 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
shopt -s nullglob
repos=(/etc/yum.repos.d/*.repo)
if [[ ${#repos[@]} -eq 0 ]]; then
exit 0
fi
upstream='https://mirror.stream.centos.org'
# Param: $1 repo id as the metalink query spells it, $2 directory on the upstream
for_repo() {
sed -i -E \
"s#^metalink=https?://mirrors\\.centos\\.org/metalink\\?repo=centos-$1-([^-&]+)-stream.*#baseurl=$upstream/\\1-stream/$2/\\\$basearch/os/#" \
"${repos[@]}"
}
for_repo baseos BaseOS
for_repo appstream AppStream
sed -i -E \
"s#^metalink=https?://mirrors\\.centos\\.org/metalink\\?repo=centos-extras-sig-extras-common-([^-&]+)-stream.*#baseurl=$upstream/SIGs/\\1-stream/extras/\\\$basearch/extras-common/#" \
"${repos[@]}"