From ea0582bedc71533e02aa7dbf3c23413e276e7d20 Mon Sep 17 00:00:00 2001 From: Baerspektivo Date: Wed, 16 Sep 2026 09:48:21 +0200 Subject: [PATCH] feat(fish): add dist-upgrade and autoremove for Debian, Fedora, and Arch in update-system --- .config/fish/functions/update-system.fish | 33 ++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.config/fish/functions/update-system.fish b/.config/fish/functions/update-system.fish index 31d5818..cbda022 100644 --- a/.config/fish/functions/update-system.fish +++ b/.config/fish/functions/update-system.fish @@ -31,21 +31,42 @@ function update-system --description "Update system packages depending on OS" npm update -g end else if test -f /etc/arch-release - echo (set_color blue)"[Update-System] Arch Linux erkannt. Starte System-Update..."(set_color normal) + echo (set_color blue)"[Update-System] Arch Linux erkannt. Starte vollständiges System-Update..."(set_color normal) if type -q yay - # yay handles password prompts and elevation internally, so we run it directly yay -Syu + set -l orphans (pacman -Qtdq 2>/dev/null) + if test -n "$orphans" + echo (set_color blue)"[Update-System] Entferne ungenutzte Abhängigkeiten (autoremove)..."(set_color normal) + yay -Rns --noconfirm $orphans + end else run_with_sudo pacman -Syu + set -l orphans (pacman -Qtdq 2>/dev/null) + if test -n "$orphans" + echo (set_color blue)"[Update-System] Entferne ungenutzte Abhängigkeiten (autoremove)..."(set_color normal) + run_with_sudo pacman -Rns --noconfirm $orphans + end end else if test -f /etc/debian_version - echo (set_color blue)"[Update-System] Debian/Ubuntu-basiertes System erkannt. Starte System-Update..."(set_color normal) - run_with_sudo apt update; and run_with_sudo apt upgrade -y + echo (set_color blue)"[Update-System] Debian/Ubuntu-basiertes System erkannt. Starte vollständiges System-Update..."(set_color normal) + run_with_sudo apt update + and run_with_sudo apt upgrade -y + and run_with_sudo apt dist-upgrade -y + and run_with_sudo apt autoremove -y + and run_with_sudo apt autoclean else if test -f /etc/fedora-release - echo (set_color blue)"[Update-System] Fedora erkannt. Starte System-Update..."(set_color normal) - run_with_sudo dnf upgrade -y + echo (set_color blue)"[Update-System] Fedora erkannt. Starte vollständiges System-Update..."(set_color normal) + run_with_sudo dnf upgrade --refresh -y + and run_with_sudo dnf autoremove -y else echo (set_color red)"[Update-System] Unbekanntes Betriebssystem. Keine automatische Aktualisierung möglich."(set_color normal) return 1 end + + # Optional: Flatpak-Pakete aktualisieren und ungenutzte Runtimes entfernen + if test "$os" != "Darwin"; and type -q flatpak + echo (set_color blue)"[Update-System] Aktualisiere Flatpaks..."(set_color normal) + flatpak update -y + flatpak uninstall --unused -y + end end