From 4e4e82c5b911b65a573619965c6d178cc611383d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saull=20Brand=C3=A3o?= Date: Sat, 26 Jul 2025 13:17:13 -0300 Subject: [PATCH] fix chaotic aur installation --- install/preflight/aur.sh | 34 ++++++++++++++++++++-------------- migrations/1753352057.sh | 25 ++++++++++++------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/install/preflight/aur.sh b/install/preflight/aur.sh index 02ff90d..8dcbc3f 100644 --- a/install/preflight/aur.sh +++ b/install/preflight/aur.sh @@ -1,27 +1,34 @@ #!/bin/bash +chaotic_ok=0 + # Only add Chaotic-AUR if the architecture is x86_64 so ARM users can build the packages if [[ "$(uname -m)" == "x86_64" ]]; then - # Import Chaotic-AUR key - sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com - sudo pacman-key --lsign-key 3056513887B78AEB + # Try installing Chaotic-AUR keyring and mirrorlist + if sudo pacman-key --recv-key 3056513887B78AEB && + sudo pacman-key --lsign-key 3056513887B78AEB && + sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' && + sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'; then - # Install Chaotic-AUR keyring and mirrorlist - sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' - sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' + # Add Chaotic-AUR repo to pacman config + echo -e '\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf >/dev/null - # Add Chaotic-AUR repo to pacman config - echo -e '\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf >/dev/null + # Refresh pacman package databases + sudo pacman -Sy - # Refresh pacman package databases - sudo pacman -Sy + chaotic_ok=1 + else + echo "Failed to install Chaotic-AUR, so won't include it in pacman config!" + fi +fi - # Install yay +if [[ $chaotic_ok -eq 1 ]]; then sudo pacman -S --needed --noconfirm yay else - sudo pacman -S --needed --noconfirm base-devel - + # Manually install yay from AUR if not already available if ! command -v yay &>/dev/null; then + # Install build tools + sudo pacman -S --needed --noconfirm base-devel cd /tmp git clone https://aur.archlinux.org/yay-bin.git cd yay-bin @@ -30,7 +37,6 @@ else rm -rf yay-bin cd ~ fi - fi # Add fun and color to the pacman installer diff --git a/migrations/1753352057.sh b/migrations/1753352057.sh index 431c5e2..653938f 100755 --- a/migrations/1753352057.sh +++ b/migrations/1753352057.sh @@ -1,21 +1,20 @@ echo "Add Chaotic-AUR to get compiled binaries" if [[ "$(uname -m)" == "x86_64" ]] && ! grep -q '^\[chaotic-aur\]' /etc/pacman.conf; then - # Import Chaotic-AUR key - sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com - sudo pacman-key --lsign-key 3056513887B78AEB + # Try installing Chaotic-AUR keyring and mirrorlist + if sudo pacman-key --recv-key 3056513887B78AEB && + sudo pacman-key --lsign-key 3056513887B78AEB && + sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' && + sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'; then - # Install Chaotic-AUR keyring and mirrorlist - sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' - sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' - - if [[ -f /etc/pacman.d/chaotic-mirrorlist ]]; then # Add Chaotic-AUR repo to pacman config echo -e '\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf >/dev/null - else - echo "Failed to download chaotic-mirrorlist, so won't include it in pacman config!" - fi - # Refresh pacman package databases - sudo pacman -Sy + # Refresh pacman package databases + sudo pacman -Sy + + chaotic_ok=1 + else + echo "Failed to install Chaotic-AUR, so won't include it in pacman config!" + fi fi