summaryrefslogtreecommitdiff
path: root/raveos-calamares-theme/etc/calamares/modules/raveos-tukor-rangsor.sh
blob: 9f4cccbf462de7d427e471e8b901ec3e5a309160 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
set -uo pipefail

LISTA=/etc/pacman.d/mirrorlist
UJ=$(mktemp)

for _ in $(seq 1 90); do
  systemctl is-active reflector-once.service chaotic-rankmirrors.service 2>/dev/null | grep -qx activating || break
  sleep 1
done

echo ">>> [tukor] Arch tukrok rangsorolasa"
if timeout 150 reflector --country HU,AT,DE,PL,CZ,SK --protocol https --completion-percent 100 --delay 3 \
    --latest 20 --sort rate --number 10 --download-timeout 10 --connection-timeout 5 --threads 5 \
    --save "$UJ" && grep -q '^Server' "$UJ"; then
  cp -f "$LISTA" "$LISTA.regi" 2>/dev/null || true
  install -m644 "$UJ" "$LISTA"
  echo ">>> [tukor] Uj tukorlista:"
  grep '^Server' "$LISTA"
else
  echo ">>> [tukor] A reflector nem sikerult, a meglevo tukorlista marad"
fi
rm -f "$UJ"

if [ -f /usr/local/bin/chaotic-rankmirrors ]; then
  timeout 120 bash /usr/local/bin/chaotic-rankmirrors || true
fi

exit 0