#!/bin/bash

# Print the logo
print_logo() {
    cat << "EOF"


 ██╗  ██╗ █████╗ ███╗   ███╗██████╗  █████╗  ██████╗██╗  ██╗
 ██║  ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝
 ███████║███████║██╔████╔██║██████╔╝███████║██║     █████╔╝ 
 ██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║     ██╔═██╗ 
 ██║  ██║██║  ██║██║ ╚═╝ ██║██║     ██║  ██║╚██████╗██║  ██╗
 ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚═╝     ╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝                                                                                                     
                                                                                                     

EOF
}

# Clear screen and show logo
clear
print_logo

echo "Updating Arch..."
sudo pacman -Syu

echo "Updating AUR..."

if ! yay -Sua 2>/dev/null; then
    echo "yay -Sua returned an error. Let's rebuild YAY."
    sudo pacman -R yay
    cd /tmp
    git clone https://aur.archlinux.org/yay.git
    cd yay
    makepkg -si
    cd ..
    rm -rf yay
    cd
    yay -Sua --noconfirm
else
    yay -Sua --noconfirm
fi

# Will need to update the downloaded binaries and the compiled apps
# In the area below...

echo "Done. You probably want to reboot your system..."
