31 lines
744 B
Bash
31 lines
744 B
Bash
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
echo "================================="
|
|
echo " Runflare AlmaLinux Mirror Setup"
|
|
echo "================================="
|
|
|
|
source /etc/os-release
|
|
|
|
if [[ "$ID" != "almalinux" ]]; then
|
|
echo "This script only supports AlmaLinux."
|
|
exit 1
|
|
fi
|
|
|
|
echo "[1/3] Backing up repo files..."
|
|
cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
|
|
|
|
echo "[2/3] Updating repo configuration..."
|
|
|
|
for f in /etc/yum.repos.d/*.repo; do
|
|
sed -i 's/^mirrorlist/#mirrorlist/g' "$f"
|
|
sed -i 's/^#baseurl/baseurl/g' "$f"
|
|
sed -i 's|^baseurl=.*|baseurl=http://mirror-linux.runflare.com/almalinux/\$releasever/\$basearch/os/|g' "$f"
|
|
done
|
|
|
|
echo "[3/3] Refreshing cache..."
|
|
dnf clean all
|
|
dnf makecache
|
|
|
|
echo "AlmaLinux mirror configured."
|