Improve update and migration flow

This commit is contained in:
Ryan Hughes
2026-06-04 18:38:25 -04:00
parent c8ed1e77ae
commit 0804962619
39 changed files with 2068 additions and 84 deletions
+23 -7
View File
@@ -1,13 +1,29 @@
#!/bin/bash
# omarchy:summary=Remove orphaned system packages after updates
# omarchy:summary=Review and optionally remove orphaned system packages after updates
# omarchy:requires-sudo=true
orphans=$(pacman -Qtdq || true)
if [[ -n $orphans ]]; then
echo -e "\e[32m\nRemove orphan system packages\e[0m"
for pkg in $orphans; do
sudo pacman -Rs --noconfirm "$pkg" || true
done
set -e
mapfile -t orphans < <(pacman -Qtdq 2>/dev/null || true)
(( ${#orphans[@]} )) || exit 0
echo -e "\e[32m\nOrphan system packages\e[0m"
printf ' %s\n' "${orphans[@]}"
echo
if [[ ! -t 0 || ! -t 1 ]]; then
echo "${#orphans[@]} orphaned package(s) found. Re-run omarchy-update-orphan-pkgs in a terminal to review/remove them."
echo
exit 0
fi
if ! gum confirm --default=false "Remove ${#orphans[@]} orphaned package(s)?"; then
echo "Keeping orphaned packages."
echo
exit 0
fi
echo -e "\e[32m\nRemoving orphan system packages\e[0m"
sudo pacman -Rns "${orphans[@]}"
echo