From 6837fb02da1a68bf5d05bc2e6199cb16c787da68 Mon Sep 17 00:00:00 2001 From: Biocoder Date: Thu, 12 Oct 2023 01:53:04 +0300 Subject: [PATCH] rankmirrors parallel --- .scripts/arch/rankmirrors-update | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.scripts/arch/rankmirrors-update b/.scripts/arch/rankmirrors-update index 95ea0b5..5afe4e0 100755 --- a/.scripts/arch/rankmirrors-update +++ b/.scripts/arch/rankmirrors-update @@ -1,13 +1,23 @@ #!/bin/sh -e +PACKAGES="" + if ! [ -x "$(command -v rankmirrors)" ]; then - sudo pacman -Sy --noconfirm --needed pacman-contrib + PACKAGES="$PACKAGES pacman-contrib" +fi + +if ! [ -x "$(command -v parallel)" ]; then + PACKAGES="$PACKAGES parallel" +fi + +if [ "$PACKAGES" != "" ]; then + sudo pacman -Sy --noconfirm --needed "$PACKAGES" fi SOURCE="https://archlinux.org/mirrorlist/?protocol=https&use_mirror_status=on" echo "Using source: $SOURCE" echo "Starting rankmirrors, it can take a while" -curl -s "$SOURCE" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors - | sudo tee /etc/pacman.d/mirrorlist +curl -s "$SOURCE" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -p - | sudo tee /etc/pacman.d/mirrorlist echo "rankmirrors-update done."