#!/bin/bash

# omarchy:summary=Reinstall all default Omarchy packages from the stable channel, or on aarch64 the edge channel
# omarchy:requires-sudo=true

set -e

# Reinstall all default Omarchy packages from the platform's default channel
# (stable, or edge on aarch64) and downgrade any packages that are too new.

# Set the package repository to the platform's default channel
omarchy-refresh-pacman

# Downgrade any packages to that channel's setup
omarchy-update-pacman -Suu --noconfirm

# Ensure this platform's default packages are installed
default_packages=$(omarchy-pkg-defaults)
mapfile -t packages <<<"$default_packages"
omarchy-update-pacman -Syu --noconfirm --needed "${packages[@]}"
