feat: harden fullupgrade and document release workflow
Add set -euo pipefail, root checks, safer orphan cleanup, and a help message to fullupgrade. Refresh the README and project notes to match the current scripts and release process.
This commit is contained in:
+59
-4
@@ -1,6 +1,61 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
pacman -Sy --noconfirm archlinux-keyring
|
||||
pacman -Syu --noconfirm
|
||||
pacman -Rns $(pacman -Qqtd) --noconfirm
|
||||
pacman -Sc --noconfirm
|
||||
show_help() {
|
||||
cat <<'EOF'
|
||||
Usage: fullupgrade
|
||||
|
||||
Met à jour Arch Linux et effectue un nettoyage:
|
||||
- mise à jour de archlinux-keyring
|
||||
- synchronisation complète du système
|
||||
- suppression des paquets orphelins
|
||||
- nettoyage du cache pacman
|
||||
|
||||
Attention: ce script modifie le système et s'exécute sans confirmation.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
require_root() {
|
||||
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
|
||||
echo "Erreur: ce script doit être exécuté en root." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup_orphans() {
|
||||
local orphans=()
|
||||
|
||||
mapfile -t orphans < <(pacman -Qqtd)
|
||||
|
||||
if [ "${#orphans[@]}" -gt 0 ]; then
|
||||
pacman -Rns --noconfirm "${orphans[@]}"
|
||||
else
|
||||
echo "Aucun paquet orphelin à supprimer."
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
require_root
|
||||
|
||||
echo "Mise à jour de archlinux-keyring..."
|
||||
pacman -Sy --noconfirm archlinux-keyring
|
||||
|
||||
echo "Mise à jour complète du système..."
|
||||
pacman -Syu --noconfirm
|
||||
|
||||
echo "Recherche des paquets orphelins..."
|
||||
cleanup_orphans
|
||||
|
||||
echo "Nettoyage du cache pacman..."
|
||||
pacman -Sc --noconfirm
|
||||
|
||||
echo "Mise à jour terminée avec succès."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user