#!/usr/bin/sh

sudo echo "Authenticated as root" || exit

if paru -Syu --noconfirm; then
    echo "UPDATE SUCCEDEED"
else
    echo "UPDATE FAILED"
    exit 1
fi


echo "==================================================================="

# shellcheck disable=SC2046
sudo pacman -Rns --noconfirm $(pacman -Qtdq)

if sudo checkservices; then
    echo "CHECKSERVICES SUCCEDEED"
else
    echo "CHECKSERVICES FAILED"
    exit 1
fi

echo ""

flatpak update -y