diff --git a/bin/omarchy-ensure-aur-available b/bin/omarchy-ensure-aur-available deleted file mode 100755 index d83b675d..00000000 --- a/bin/omarchy-ensure-aur-available +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if ! curl -s --connect-timeout 10 --head -A "omarchy-update" -o /dev/null "https://aur.archlinux.org/"; then - gum spin --spinner "globe" --title "The AUR package repository is currently unavailable, please try again later" -- sleep 2 && exit 1 -fi diff --git a/bin/omarchy-pkg-repos-accessible b/bin/omarchy-pkg-repos-accessible new file mode 100755 index 00000000..f7d2c682 --- /dev/null +++ b/bin/omarchy-pkg-repos-accessible @@ -0,0 +1,27 @@ +#!/bin/bash + +echo "Ensuring all package repositories are available..." + +# Ensure Arch mirror is available +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 + echo -e "\e[31mArch mirror is unavailable. Retrying in 10 seconds...\e[0m" + sleep 10 + fi +done + +# Ensure AUR is available +while true; do + if curl -sfI --connect-timeout 30 -A "omarchy-update" https://aur.archlinux.org >/dev/null && + curl -sf -A "omarchy-update" \ + "https://aur.archlinux.org/rpc/?v=5&type=info&arg=base" | + jq -e '.type=="info"' >/dev/null; then + break + else + echo -e "\e[31mAUR is unavailable. Retrying in 10 seconds...\e[0m" + sleep 10 + fi +done diff --git a/bin/omarchy-update b/bin/omarchy-update index 9cf8d514..72391888 100755 --- a/bin/omarchy-update +++ b/bin/omarchy-update @@ -2,6 +2,7 @@ set -e +omarchy-pkg-repos-accessible omarchy-snapshot create || [ $? -eq 127 ] omarchy-update-git omarchy-migrate diff --git a/install/preflight/aur.sh b/install/preflight/aur.sh index ebd3eedd..359f83ab 100644 --- a/install/preflight/aur.sh +++ b/install/preflight/aur.sh @@ -3,29 +3,8 @@ # Install build tools sudo pacman -Sy --needed --noconfirm base-devel -# Ensure Arch mirror is available -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 - echo -e "\n\e[31mArch mirror is unavailable. Retrying in 10 seconds...\e[0m" - sleep 10 - fi -done - -# Ensure AUR is available -while true; do - if curl -sfI --connect-timeout 30 -A "omarchy-update" https://aur.archlinux.org >/dev/null && - curl -sf -A "omarchy-update" \ - "https://aur.archlinux.org/rpc/?v=5&type=info&arg=base" | - jq -e '.type=="info"' >/dev/null; then - break - else - echo -e "\n\e[31mAUR is unavailable. Retrying in 10 seconds...\e[0m" - sleep 10 - fi -done +# Ensure package repositories are accessible before proceeding +omarchy-pkg-repos-accessible # Only add Chaotic-AUR if the architecture is x86_64 so ARM users can build the packages if [[ "$(uname -m)" == "x86_64" ]] && [ -z "$DISABLE_CHAOTIC" ] && ! command -v yay &>/dev/null; then