2025-08-24 11:54:19 +02:00

53 lines
1.8 KiB
Bash

#!/bin/bash
# Install build tools
sudo pacman -Sy --needed --noconfirm base-devel
# Ensure AUR is available
while true; do
if curl -s --retry 4 --connect-timeout 30 --head -A "omarchy-update" "https://aur.archlinux.org"; then
break
else
echo -e "\n\e[31mAUR is unavailable. Retrying in 10 seconds.\e[0m"
sleep 10
fi
done
# 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
# Try installing Chaotic-AUR keyring and mirrorlist
if ! pacman-key --list-keys 3056513887B78AEB >/dev/null 2>&1 &&
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
# Add Chaotic-AUR repo to pacman config
if ! grep -q "chaotic-aur" /etc/pacman.conf; then
echo -e '\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf >/dev/null
fi
# Install yay directly from Chaotic-AUR
sudo pacman -Sy --needed --noconfirm yay
else
echo "Failed to install Chaotic-AUR, so won't include it in pacman config!"
fi
fi
# Manually install yay from AUR if not already available
if ! command -v yay &>/dev/null; then
cd /tmp
rm -rf yay-bin
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si --noconfirm
cd -
rm -rf yay-bin
cd ~
fi
# Add fun and color and verbosity to the pacman installer
if ! grep -q "ILoveCandy" /etc/pacman.conf; then
sudo sed -i '/^\[options\]/a Color\nILoveCandy\nVerbosePkgLists' /etc/pacman.conf
fi