#!/bin/bash echo "Updating AUR..." YAY_FLAGS="--noconfirm --answerdiff=None --answeredit=None --answerclean=None" # Only rebuild yay when yay itself is broken (e.g. a pacman upgrade bumped # libalpm). A failing AUR package is not fixed by a rebuild, so let that error # show and fail the hook instead. if ! yay --version &>/dev/null; then echo "yay is broken (likely a libalpm bump). Rebuilding yay..." sudo pacman -R --noconfirm yay cd /tmp rm -rf yay git clone https://aur.archlinux.org/yay.git cd yay makepkg -si --noconfirm cd .. rm -rf yay cd fi yay -Sua $YAY_FLAGS