From 7e40a565cc0e828fcf8c60c8eea42dd8a0cb4869 Mon Sep 17 00:00:00 2001 From: nocode Date: Sat, 4 Jul 2026 12:56:57 +0200 Subject: [PATCH] feat(fws-update): add system update utility script Add fws-update script to provide a one-command system update solution accessible from taskbar, fws-hello menu, or terminal. The script performs: - System update via pacman -Syu - Package cache cleanup (retains 2 latest versions) - Orphaned package detection and optional removal - Flatpak updates if available Requires root privileges and prompts for user confirmation on orphan removal. --- .../releng/airootfs/usr/local/bin/fws-update | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 configs/releng/airootfs/usr/local/bin/fws-update diff --git a/configs/releng/airootfs/usr/local/bin/fws-update b/configs/releng/airootfs/usr/local/bin/fws-update new file mode 100755 index 0000000..c8acd4a --- /dev/null +++ b/configs/releng/airootfs/usr/local/bin/fws-update @@ -0,0 +1,33 @@ +#!/bin/bash +# FWS — mise à jour du système en une commande (bouton de la barre, fws-hello, +# ou terminal). pacman -Syu + nettoyage du cache + rapport des orphelins. +set -u +say() { printf '\n\033[1;34m==> %s\033[0m\n' "$*"; } + +if [ "$(id -u)" -ne 0 ]; then + exec sudo "$0" "$@" +fi + +say "Mise à jour du système (pacman -Syu)…" +pacman -Syu || { echo "Échec de la mise à jour (réseau ?)"; read -rp "Entrée pour fermer. " _; exit 1; } + +if command -v paccache >/dev/null 2>&1; then + say "Nettoyage du cache des paquets (2 dernières versions gardées)…" + paccache -rk2 +fi + +ORPHANS="$(pacman -Qtdq 2>/dev/null)" +if [ -n "$ORPHANS" ]; then + say "Paquets orphelins (plus requis par rien) :" + echo "$ORPHANS" + read -rp "Les supprimer ? [o/N] " _rm + case "$_rm" in o|O|oui) echo "$ORPHANS" | pacman -Rns --noconfirm - ;; esac +fi + +if command -v flatpak >/dev/null 2>&1; then + say "Mise à jour des Flatpaks…" + flatpak update -y || true +fi + +say "Système à jour ✔" +read -rp "Entrée pour fermer. " _