Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions bin/omarchy-setup-chaotic-aur
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

setup_chaotic_aur() {
if [[ "$(uname -m)" != "x86_64" ]]; then
echo "Chaotic-AUR is only supported on x86_64 architecture."
return 0
fi

if grep -q "^\[chaotic-aur\]" /etc/pacman.conf; then
echo "Chaotic-AUR is already configured."
return 0
fi


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

echo -e '\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf >/dev/null

sudo pacman -Sy --needed --noconfirm yay
else
echo "Failed to install Chaotic-AUR; skipping update to pacman.conf"
fi
}

echo -e "Chaotic-AUR is an unofficial, \e[1moptional\e[0m repository that provides pre-built AUR packages."
echo "Using it is not required. Please ensure you understand the potential risks."
echo "https://aur.chaotic.cx"

echo -ne "\e[33m\nWould you like to setup the Chaotic-AUR repository? [Y/n]\e[0m"

while true; do
read -rsn1 choice
if [[ "$choice" =~ ^[YyNn]$ || -z "$choice" ]]; then
case "$choice" in
[Yy] | "" ) echo; setup_chaotic_aur; break ;;
[Nn] ) echo; echo "Chaotic-AUR will not be setup."; break ;;
esac
fi
done
echo
2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ show_subtext() {
}

# Install prerequisites
clear
echo -e "\e[1mInstalling prerequisites [0/5]\e[0m\n"
source $OMARCHY_INSTALL/preflight/aur.sh
source $OMARCHY_INSTALL/preflight/presentation.sh
source $OMARCHY_INSTALL/preflight/migrations.sh
Expand Down
21 changes: 1 addition & 20 deletions install/preflight/aur.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
#!/bin/bash

# Only add Chaotic-AUR if the architecture is x86_64 so ARM users can build the packages
if [[ "$(uname -m)" == "x86_64" ]] && ! 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
source ~/.local/share/omarchy/bin/omarchy-setup-chaotic-aur

# Manually install yay from AUR if not already available
if ! command -v yay &>/dev/null; then
Expand Down