summaryrefslogtreecommitdiff
path: root/portage-timestamp.sh
blob: cbe006d70a29678381a2706267f74b7fc7f08a89 (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
#!/bin/bash
# try-portage-timestamp.sh
# Loop through Gentoo rsync mirrors and grab timestamp.chk

MIRRORS=(
  rsync://rsync.gentoo.org/gentoo-portage/metadata/timestamp.chk
  rsync://rsync1.de.gentoo.org/gentoo-portage/metadata/timestamp.chk
  rsync://rsync.uk.gentoo.org/gentoo-portage/metadata/timestamp.chk
  rsync://rsync.fr.gentoo.org/gentoo-portage/metadata/timestamp.chk
  rsync://rsync.us.gentoo.org/gentoo-portage/metadata/timestamp.chk
)

for SRC in "${MIRRORS[@]}"; do
  echo "Trying $SRC ..."
  OUT=$(rsync --no-motd "$SRC" /dev/stdout 2>/dev/null)
  if [[ -n "$OUT" ]]; then
    echo ">>> Success from $SRC"
    echo "$OUT"
    exit 0
  fi
done

echo "!!! No mirror returned a timestamp.chk"
exit 1