omarchy/bin/omarchy-pkg-repos-accessible
David Heinemeier Hansson 6826cad95b Simplify it
2025-08-24 15:55:18 +02:00

36 lines
864 B
Bash
Executable File

#!/bin/bash
echo "Ensuring all package repositories are available..."
# Backoff sequence in seconds
BACKOFFS=(10 30 60 300 600)
# Ensure Arch mirror is available
i=0
while true; do
if curl -sfI -A "omarchy-update" \
https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db >/dev/null; then
break
else
wait=${BACKOFFS[$i]:-${BACKOFFS[-1]}}
echo -e "\e[31mArch mirror is unavailable. Retrying in $wait seconds...\e[0m"
sleep "$wait"
((i++))
fi
done
# Ensure AUR is available
i=0
while true; do
if curl -sf --connect-timeout 30 -A "omarchy-update" \
"https://aur.archlinux.org/rpc/?v=5&type=info&arg=base" |
jq -e '.type=="multiinfo"' >/dev/null; then
break
else
wait=${BACKOFFS[$i]:-${BACKOFFS[-1]}}
echo -e "\e[31mAUR is unavailable. Retrying in $wait seconds...\e[0m"
sleep "$wait"
((i++))
fi
done