Simplify guard against an unavailable AUR

This commit is contained in:
David Heinemeier Hansson 2025-08-24 17:41:41 +02:00
parent 673cea1644
commit f1af28f10d
5 changed files with 16 additions and 40 deletions

5
bin/omarchy-pkg-aur-accessible Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
curl -sf --connect-timeout 30 -A "omarchy-update" \
"https://aur.archlinux.org/rpc/?v=5&type=info&arg=base" |
jq -e empty >/dev/null

View File

@ -1,35 +0,0 @@
#!/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

View File

@ -2,7 +2,6 @@
set -e
omarchy-pkg-repos-accessible
omarchy-snapshot create || [ $? -eq 127 ]
omarchy-update-git
omarchy-migrate

View File

@ -1,9 +1,18 @@
#!/bin/bash
echo -e "\e[32m\nUpdate system packages\e[0m"
yay -Syu --noconfirm
sudo pacman -Syu --noconfirm
echo
if omarchy-pkg-aur-accessible; then
echo -e "\e[32m\nUpdate AUR packages\e[0m"
yay -Syu --noconfirm
echo
else
echo -e "\e[31m\nAUR is unavailable, skipping updates\e[0m"
echo
fi
echo -e "\e[32m\nRemove orphan system packages\e[0m"
sudo pacman -Rs $(pacman -Qtdq)
echo

View File

@ -1,8 +1,6 @@
#!/bin/bash
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
if omarchy-pkg-aur-accessible; then
if [ -z "$OMARCHY_BARE" ]; then
yay -S --noconfirm --needed \
1password-beta 1password-cli \