#!/bin/bash

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

set -e

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

# Refresh repository metadata
omarchy-refresh-pacman

# Downgrade any packages to the stable setup
omarchy-update-dnf dnf distro-sync -y

# Ensure all packages are installed
mapfile -t packages < <(grep -v '^#' "$OMARCHY_PATH/install/omarchy-base.packages" | grep -v '^$')
omarchy-update-dnf dnf install -y "${packages[@]}"
