#!/bin/bash

# archypr:summary=Reinstall all default Omarchy packages from the stable channel
# archypr:requires-sudo=true

set -e

# Reinstall all default Omarchy packages from the stable channel and downgrade any packages that are too new.

# Set the package repository to the stable mirrors
archypr-efresh-pacman

# Downgrade any packages to the stable setup
sudo pacman -Suu --noconfirm

# Ensure all packages are installed
mapfile -t packages < <(grep -v '^#' "$ARCHYPR_PATH/install/archypr-ase.packages" | grep -v '^$')
sudo pacman -Syu --noconfirm --needed "${packages[@]}"
