From f1af28f10d26ebee032e58414be9d7ff917a420d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 24 Aug 2025 17:41:41 +0200 Subject: [PATCH] Simplify guard against an unavailable AUR --- bin/omarchy-pkg-aur-accessible | 5 +++++ bin/omarchy-pkg-repos-accessible | 35 -------------------------------- bin/omarchy-update | 1 - bin/omarchy-update-system-pkgs | 11 +++++++++- install/apps/aur.sh | 4 +--- 5 files changed, 16 insertions(+), 40 deletions(-) create mode 100755 bin/omarchy-pkg-aur-accessible delete mode 100755 bin/omarchy-pkg-repos-accessible diff --git a/bin/omarchy-pkg-aur-accessible b/bin/omarchy-pkg-aur-accessible new file mode 100755 index 00000000..4064153a --- /dev/null +++ b/bin/omarchy-pkg-aur-accessible @@ -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 diff --git a/bin/omarchy-pkg-repos-accessible b/bin/omarchy-pkg-repos-accessible deleted file mode 100755 index b280bb43..00000000 --- a/bin/omarchy-pkg-repos-accessible +++ /dev/null @@ -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 diff --git a/bin/omarchy-update b/bin/omarchy-update index 72391888..9cf8d514 100755 --- a/bin/omarchy-update +++ b/bin/omarchy-update @@ -2,7 +2,6 @@ set -e -omarchy-pkg-repos-accessible omarchy-snapshot create || [ $? -eq 127 ] omarchy-update-git omarchy-migrate diff --git a/bin/omarchy-update-system-pkgs b/bin/omarchy-update-system-pkgs index f825a9a6..642c3214 100755 --- a/bin/omarchy-update-system-pkgs +++ b/bin/omarchy-update-system-pkgs @@ -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 diff --git a/install/apps/aur.sh b/install/apps/aur.sh index bfb33887..1dca09a7 100644 --- a/install/apps/aur.sh +++ b/install/apps/aur.sh @@ -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 \