From e707ca116f0f48184367d648493816d23a0b7cbe Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Tue, 26 May 2026 01:23:36 -0400 Subject: [PATCH] Remove retired upgrade packages together --- bin/omarchy-upgrade-to-4 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-upgrade-to-4 b/bin/omarchy-upgrade-to-4 index a8447c59..136924f5 100755 --- a/bin/omarchy-upgrade-to-4 +++ b/bin/omarchy-upgrade-to-4 @@ -428,9 +428,25 @@ remove_retired_default_packages() { log "Removing packages retired from the Omarchy 4 default install" local pkg + local installed_retired=() for pkg in "${retired_packages[@]}"; do if pacman -Q "$pkg" >/dev/null 2>&1; then - as_root pacman -Rns --noconfirm "$pkg" || warn "Could not remove retired package '$pkg'; leaving it installed." + installed_retired+=("$pkg") + fi + done + + ((${#installed_retired[@]})) || return 0 + + # Remove as one transaction so dependency anchors like omarchy-walker and all + # of its elephant-* modules disappear together instead of failing one-by-one. + if as_root pacman -Rns --noconfirm --ask 4 "${installed_retired[@]}"; then + return 0 + fi + + warn "Batch retired-package removal failed; retrying packages individually." + for pkg in "${installed_retired[@]}"; do + if pacman -Q "$pkg" >/dev/null 2>&1; then + as_root pacman -Rns --noconfirm --ask 4 "$pkg" || warn "Could not remove retired package '$pkg'; leaving it installed." fi done }