️ perf(improve): system's speed and the number of mirrors being tested, you can adjust the --concurrency parameter

This commit is contained in:
Eshan Roy
2024-11-19 09:42:14 +05:30
parent 5842a4ec59
commit e6f710c637

View File

@@ -1,12 +1,33 @@
#!/bin/bash #!/bin/bash
# Define function to check if rate-mirrors is installed
check_dependencies() {
if ! command -v /usr/bin/rate-mirrors &>/dev/null; then
echo "Error: rate-mirrors is not installed. Please install it first."
exit 1
fi
}
# Check for rate-mirrors dependency
check_dependencies
echo echo
echo "Getting Fastest Mirror..." echo "Getting Fastest Mirror..."
echo echo
sudo /usr/bin/rate-mirrors --concurrency 40 --disable-comments --allow-root --save /etc/pacman.d/mirrorlist arch # Run rate-mirrors for the Arch and Chaotic-AUR repositories
sudo /usr/bin/rate-mirrors --concurrency 40 --disable-comments --allow-root --save /etc/pacman.d/chaotic-mirrorlist chaotic-aur echo "Finding fastest mirrors for Arch..."
if ! sudo /usr/bin/rate-mirrors --concurrency 40 --disable-comments --allow-root --save /etc/pacman.d/mirrorlist arch; then
echo "Error: Failed to update the Arch mirrorlist."
exit 1
fi
echo "Finding fastest mirrors for Chaotic-AUR..."
if ! sudo /usr/bin/rate-mirrors --concurrency 40 --disable-comments --allow-root --save /etc/pacman.d/chaotic-mirrorlist chaotic-aur; then
echo "Error: Failed to update the Chaotic-AUR mirrorlist."
exit 1
fi
echo echo
echo "Fastest mirrors have been set..." echo "Fastest mirrors have been set for both Arch and Chaotic-AUR."
echo echo