From d2af4a8a843b25227dc329522dd9880660666a9c Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Sun, 7 Jul 2024 02:16:49 +0200 Subject: [PATCH] feat: Check for services that require a post upgrade restart on packages upgrade (#203) Check if any services need to be restarted after updating and offers to do so (if there are). The listing of the services is done via `checkservices` from [archlinux/contrib](https://github.com/archlinux/contrib) (available in the [extra] [archlinux-contrib](https://archlinux.org/packages/extra/any/archlinux-contrib/) package). **Important notes:** - The services that may need a post upgrade restart are only checked if an actual package(s) upgrade has been performed by `arch-update` beforehand. This is because the listing of services via `checkservices` requires elevated privileges (as it needs to run `systemctl daemon reload/reexec`), and it would be unexpected to ask for a `sudo/doas/run0` password **everytime** arch-update is executed (even if there's no update available). Checking for this only if an actual package(s) upgrade has been performed beforehand means we already have elevated privileges (as this is required for the package update itself anyway), and such needs for post upgrade service restarts are triggered on package(s) updates anyway, so it kinda makes sense only checking at that moment. - The `dbus-broker.service` and `systemd-logind.service` services are purposely excluded from the listing as they are known for creating issues on restart (see https://github.com/bus1/dbus-broker/issues/93 & https://askubuntu.com/questions/1057028/ubuntu-18-04-freezes-when-running-systemctl-restart-systemd-logind-service) - Most well-known [display managers](https://wiki.archlinux.org/title/Display_manager#List_of_display_managers) services are also excluded as restarting a display manager would cause your current session to close/terminate, which would be unexpected (that doesn't involve display managers from the AUR though). Close https://github.com/Antiz96/arch-update/issues/181 --- README-fr.md | 8 +- README.md | 6 +- doc/man/arch-update.1 | 6 +- doc/man/fr/arch-update.1 | 6 +- po/arch-update.pot | 162 +++++++++++++++++++++++------------ po/fr.po | 175 +++++++++++++++++++++++++------------- src/script/arch-update.sh | 73 ++++++++++++++++ 7 files changed, 316 insertions(+), 120 deletions(-) diff --git a/README-fr.md b/README-fr.md index a9e078d..cb5dfc5 100644 --- a/README-fr.md +++ b/README-fr.md @@ -29,6 +29,7 @@ Fonctionnalités : - Vérification et listing automatiques des paquets orphelins et propose de les supprimer. - Vérification automatique de la présence d'anciens paquets et/ou paquets désinstallés dans le cache et propose de les supprimer. - Listing et aide au traitement des fichiers pacnew/pacsave. +- Vérification automatique des services nécessitant un redémarrage après mise à jour et propose de les redémarrer s'il y en a. - Vérification automatique des mises à jour du noyau en attente nécessitant un redémarrage et propose de redémarrer s'il y en a une. - Support de `sudo`, `doas` et `run0`. - Prise en charge optionnelle des paquets AUR (via `yay` ou `paru`). @@ -40,14 +41,14 @@ Fonctionnalités : ### AUR Installez le paquet AUR [arch-update](https://aur.archlinux.org/packages/arch-update "arch-update AUR package"). -Consultez également [la liste des dépendances optionnelles](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=arch-update#n11) dont vous pourriez avoir besoin. +Consultez également la liste des dépendances optionnelles (disponible dans la section ["depuis la source"](#depuis-la-source) ci-dessous) dont vous pourriez avoir besoin. ### Depuis la source Installez les dépendances requises : ```bash -sudo pacman -S --needed pacman-contrib curl htmlq diffutils hicolor-icon-theme python python-pyqt6 qt6-svg glib2 +sudo pacman -S --needed pacman-contrib archlinux-contrib curl htmlq diffutils hicolor-icon-theme python python-pyqt6 qt6-svg glib2 ``` Dépendances optionnelles supplémentaires dont vous pourriez avoir besoin ou que vous pourriez souhaiter : @@ -179,7 +180,8 @@ Codes de sortie : 7 Aucune mise à jour en attente durant l'utilisation de l'option `-l/--list` 8 Erreur lors de la génération d'un fichier de configuration avec l'option `--gen-config` 9 Erreur lors de la lecture du fichier de configuration avec l'option `--show-config` -10 Erreur lors de la creation du fichier desktop autostart pour l'applet systray avec l'option `--tray --enable` +10 Erreur lors de la creation du fichier desktop autostart pour l'applet systray avec l'option `--tray --enable` +11 Erreur lors du redémarrage des services nécessitant un redémarrage après mise à jour ``` Pour plus d'informations, consultez la page de manuel arch-update(1). diff --git a/README.md b/README.md index b484c81..c9dd0df 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Features: - Automatic check and listing of orphan packages and offers to remove them. - Automatic check for old and/or uninstalled cached packages and offers to remove them. - Lists and helps you processing pacnew/pacsave files. +- Automatic check for services requiring a post upgrade restart and offers to do so if there are. - Automatic check for pending kernel updates requiring a reboot to be applied and offers to do so if there's one. - Support for `sudo`, `doas` & `run0`. - Optional support for AUR packages (through `yay` or `paru`). @@ -40,14 +41,14 @@ Features: ### AUR Install the [arch-update](https://aur.archlinux.org/packages/arch-update "arch-update AUR package") AUR package. -Also check [the list of optional dependencies](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=arch-update#n11) you might need or want. +See also the list of optional dependencies (available in the ["from source"](#from-source) section below) you may need. ### From Source Install required dependencies: ```bash -sudo pacman -S --needed pacman-contrib curl htmlq diffutils hicolor-icon-theme python python-pyqt6 qt6-svg glib2 +sudo pacman -S --needed pacman-contrib archlinux-contrib curl htmlq diffutils hicolor-icon-theme python python-pyqt6 qt6-svg glib2 ``` Additional optional dependencies you might need or want: @@ -180,6 +181,7 @@ Exit Codes: 8 Error when generating a configuration file with the `--gen-config` option 9 Error when reading the configuration file with the `--show-config` option 10 Error when creating the autostart desktop file for the systray applet with the `--tray --enable` option +11 Error when restarting services that require a post upgrade restart ``` For more information, see the arch-update(1) man page. diff --git a/doc/man/arch-update.1 b/doc/man/arch-update.1 index cda6993..95d127c 100644 --- a/doc/man/arch-update.1 +++ b/doc/man/arch-update.1 @@ -20,7 +20,7 @@ If no option is passed, launch the relevant series of functions to perform a com .br Before performing the update, it offers to display the latest Arch Linux news to the user. By default, Arch news are only displayed if at least a new one has been published since the last run. Arch news published since the last run or at the same date are tagged as '[NEW]'. .br -Arch-Update also checks for orphan packages, unused Flatpak packages, old and/or uninstalled cached packages in pacman's cache, pacnew/pacsave files and pending kernel update requiring a reboot to be applied and, if there are, offers to process them. +Arch-Update also checks for orphan packages, unused Flatpak packages, old and/or uninstalled cached packages in pacman's cache, pacnew/pacsave files, services requiring a post upgrade restart as well as pending kernel update requiring a reboot to be applied and, if there are, offers to process them. .br Those functions are launched when you click on the systray applet. @@ -227,6 +227,10 @@ Error when calling the reboot command to apply a pending kernel update .B 10 .RB "Error when creating the autostart desktop file for the systray applet with the " "--tray --enable " "option" +.TP +.B 11 +Error when restarting services that require a post upgrade restart + .SH SEE ALSO .BR checkupdates (8), .BR pacman (8), diff --git a/doc/man/fr/arch-update.1 b/doc/man/fr/arch-update.1 index 6582212..a41514d 100644 --- a/doc/man/fr/arch-update.1 +++ b/doc/man/fr/arch-update.1 @@ -20,7 +20,7 @@ Si aucune option n'est passée, lance la série de fonctions adéquates pour eff .br Avant d'effectuer la mise à jour, propose d'afficher les dernières Arch news à l'utilisateur. Par défaut, les Arch news sont seulement affichées si au moins une nouvelle news a été publiée depuis la dernière exécution. Les Arch news publiées depuis la dernière exécution ou à la même date sont étiquetées comme '[NOUVEAU]'. .br -Arch-Update vérifie aussi la présence de paquets orphelins/inutilisés, d'anciens paquets mis en cache, de fichiers pacnew/pacsave et de mise à jour du noyau en attente et, s'il y en a, propose de les traiter. +Arch-Update vérifie aussi la présence de paquets orphelins/inutilisés, d'anciens paquets mis en cache, de fichiers pacnew/pacsave, de services nécessitant un redémarrage après mise à jour, ainsi que les mises à jour du noyau en attente et, s'il y en a, propose de les traiter. .br Ces fonctions sont lancées quand vous cliquez sur l'applet systray. @@ -227,6 +227,10 @@ Erreur lors de l'appel de la commande reboot pour appliquer une mise à jour du .B 10 .RB "Erreur lors de la création du fichier desktop autostart pour l'applet systray avec l'option " "--tray --enable" +.TP +.B 11 +Erreur lors du redémarrage des services nécessitant un redémarrage après mise à jour + .SH VOIR AUSSI .BR checkupdates (8), .BR pacman (8), diff --git a/po/arch-update.pot b/po/arch-update.pot index 4c2ba51..75a5485 100644 --- a/po/arch-update.pot +++ b/po/arch-update.pot @@ -197,16 +197,16 @@ msgstr "" msgid "Proceed with update? [Y/n]" msgstr "" -#: src/script/arch-update.sh:327 src/script/arch-update.sh:476 -#: src/script/arch-update.sh:509 src/script/arch-update.sh:551 -#: src/script/arch-update.sh:618 src/script/arch-update.sh:644 +#: src/script/arch-update.sh:327 src/script/arch-update.sh:480 +#: src/script/arch-update.sh:513 src/script/arch-update.sh:555 +#: src/script/arch-update.sh:622 src/script/arch-update.sh:716 #, sh-format msgid "Y" msgstr "" -#: src/script/arch-update.sh:327 src/script/arch-update.sh:476 -#: src/script/arch-update.sh:509 src/script/arch-update.sh:551 -#: src/script/arch-update.sh:618 src/script/arch-update.sh:644 +#: src/script/arch-update.sh:327 src/script/arch-update.sh:480 +#: src/script/arch-update.sh:513 src/script/arch-update.sh:555 +#: src/script/arch-update.sh:622 src/script/arch-update.sh:716 #, sh-format msgid "y" msgstr "" @@ -265,242 +265,294 @@ msgstr "" msgid "Updating Packages...\\n" msgstr "" -#: src/script/arch-update.sh:424 src/script/arch-update.sh:436 -#: src/script/arch-update.sh:447 +#: src/script/arch-update.sh:424 src/script/arch-update.sh:438 +#: src/script/arch-update.sh:451 #, sh-format msgid "" "An error has occurred during the update process\\nThe update has been " "aborted\\n" msgstr "" -#: src/script/arch-update.sh:431 +#: src/script/arch-update.sh:433 #, sh-format msgid "Updating AUR Packages...\\n" msgstr "" -#: src/script/arch-update.sh:443 +#: src/script/arch-update.sh:447 #, sh-format msgid "Updating Flatpak Packages...\\n" msgstr "" -#: src/script/arch-update.sh:454 +#: src/script/arch-update.sh:458 #, sh-format msgid "The update has been applied\\n" msgstr "" -#: src/script/arch-update.sh:466 +#: src/script/arch-update.sh:470 #, sh-format msgid "Orphan Packages:" msgstr "" -#: src/script/arch-update.sh:470 +#: src/script/arch-update.sh:474 #, sh-format msgid "" "Would you like to remove this orphan package (and its potential " "dependencies) now? [y/N]" msgstr "" -#: src/script/arch-update.sh:472 +#: src/script/arch-update.sh:476 #, sh-format msgid "" "Would you like to remove these orphan packages (and their potential " "dependencies) now? [y/N]" msgstr "" -#: src/script/arch-update.sh:478 +#: src/script/arch-update.sh:482 #, sh-format msgid "Removing Orphan Packages...\\n" msgstr "" -#: src/script/arch-update.sh:482 src/script/arch-update.sh:515 -#: src/script/arch-update.sh:558 src/script/arch-update.sh:568 -#: src/script/arch-update.sh:578 src/script/arch-update.sh:587 +#: src/script/arch-update.sh:486 src/script/arch-update.sh:519 +#: src/script/arch-update.sh:562 src/script/arch-update.sh:572 +#: src/script/arch-update.sh:582 src/script/arch-update.sh:591 #, sh-format msgid "" "An error has occurred during the removal process\\nThe removal has been " "aborted\\n" msgstr "" -#: src/script/arch-update.sh:485 src/script/arch-update.sh:518 +#: src/script/arch-update.sh:489 src/script/arch-update.sh:522 #, sh-format msgid "The removal has been applied\\n" msgstr "" -#: src/script/arch-update.sh:490 src/script/arch-update.sh:522 -#: src/script/arch-update.sh:595 +#: src/script/arch-update.sh:494 src/script/arch-update.sh:526 +#: src/script/arch-update.sh:599 #, sh-format msgid "The removal hasn't been applied\\n" msgstr "" -#: src/script/arch-update.sh:494 +#: src/script/arch-update.sh:498 #, sh-format msgid "No orphan package found\\n" msgstr "" -#: src/script/arch-update.sh:499 +#: src/script/arch-update.sh:503 #, sh-format msgid "Flatpak Unused Packages:" msgstr "" -#: src/script/arch-update.sh:503 +#: src/script/arch-update.sh:507 #, sh-format msgid "Would you like to remove this Flatpak unused package now? [y/N]" msgstr "" -#: src/script/arch-update.sh:505 +#: src/script/arch-update.sh:509 #, sh-format msgid "Would you like to remove these Flatpak unused packages now? [y/N]" msgstr "" -#: src/script/arch-update.sh:511 +#: src/script/arch-update.sh:515 #, sh-format msgid "Removing Flatpak Unused Packages..." msgstr "" -#: src/script/arch-update.sh:526 +#: src/script/arch-update.sh:530 #, sh-format msgid "No Flatpak unused package found\\n" msgstr "" -#: src/script/arch-update.sh:543 +#: src/script/arch-update.sh:547 #, sh-format msgid "Cached Packages:\\nThere's an old or uninstalled cached package\\n" msgstr "" -#: src/script/arch-update.sh:544 +#: src/script/arch-update.sh:548 #, sh-format msgid "Would you like to remove it from the cache now? [Y/n]" msgstr "" -#: src/script/arch-update.sh:546 +#: src/script/arch-update.sh:550 #, sh-format msgid "Cached Packages:\\nThere are old and/or uninstalled cached packages\\n" msgstr "" -#: src/script/arch-update.sh:547 +#: src/script/arch-update.sh:551 #, sh-format msgid "Would you like to remove them from the cache now? [Y/n]" msgstr "" -#: src/script/arch-update.sh:554 src/script/arch-update.sh:574 +#: src/script/arch-update.sh:558 src/script/arch-update.sh:578 #, sh-format msgid "Removing old cached packages..." msgstr "" -#: src/script/arch-update.sh:564 src/script/arch-update.sh:583 +#: src/script/arch-update.sh:568 src/script/arch-update.sh:587 #, sh-format msgid "Removing uninstalled cached packages..." msgstr "" -#: src/script/arch-update.sh:599 +#: src/script/arch-update.sh:603 #, sh-format msgid "No old or uninstalled cached package found\\n" msgstr "" -#: src/script/arch-update.sh:608 +#: src/script/arch-update.sh:612 #, sh-format msgid "Pacnew Files:" msgstr "" -#: src/script/arch-update.sh:612 +#: src/script/arch-update.sh:616 #, sh-format msgid "Would you like to process this file now? [Y/n]" msgstr "" -#: src/script/arch-update.sh:614 +#: src/script/arch-update.sh:618 #, sh-format msgid "Would you like to process these files now? [Y/n]" msgstr "" -#: src/script/arch-update.sh:620 +#: src/script/arch-update.sh:624 #, sh-format msgid "Processing Pacnew Files...\\n" msgstr "" -#: src/script/arch-update.sh:624 +#: src/script/arch-update.sh:628 #, sh-format msgid "The pacnew file(s) processing has been applied\\n" msgstr "" -#: src/script/arch-update.sh:627 +#: src/script/arch-update.sh:631 #, sh-format msgid "The pacnew file(s) processing hasn't been applied\\n" msgstr "" -#: src/script/arch-update.sh:631 +#: src/script/arch-update.sh:635 #, sh-format msgid "No pacnew file found\\n" msgstr "" -#: src/script/arch-update.sh:640 +#: src/script/arch-update.sh:647 +#, sh-format +msgid "Services:\\nThe following service requires a post upgrade restart\\n" +msgstr "" + +#: src/script/arch-update.sh:649 +#, sh-format +msgid "Services:\\nThe following services require a post upgrade restart\\n" +msgstr "" + +#: src/script/arch-update.sh:659 +#, sh-format +msgid "" +"Select the service(s) to restart (e.g. 1 3 5), select 0 to restart them all " +"or press \"enter\" to continue without restarting the service(s):" +msgstr "" + +#: src/script/arch-update.sh:665 src/script/arch-update.sh:692 +#, sh-format +msgid "Service(s) restarted successfully\\n" +msgstr "" + +#: src/script/arch-update.sh:668 src/script/arch-update.sh:695 +#, sh-format +msgid "" +"An error has occurred during the service(s) restart\\nPlease, verify the " +"above service(s) status\\n" +msgstr "" + +#: src/script/arch-update.sh:681 +#, sh-format +msgid "The ${service_selected} service has been successfully restarted" +msgstr "" + +#: src/script/arch-update.sh:683 +#, sh-format +msgid "" +"An error has occurred during the restart of the ${service_selected} service" +msgstr "" + +#: src/script/arch-update.sh:699 +#, sh-format +msgid "" +"The service(s) restart hasn't been performed\\nPlease, consider restarting " +"services that have been updated to fully apply the upgrade\\n" +msgstr "" + +#: src/script/arch-update.sh:703 +#, sh-format +msgid "No service requiring a post upgrade restart found\\n" +msgstr "" + +#: src/script/arch-update.sh:712 #, sh-format msgid "" "Reboot required:\\nThere's a pending kernel update on your system requiring " "a reboot to be applied\\n" msgstr "" -#: src/script/arch-update.sh:641 +#: src/script/arch-update.sh:713 #, sh-format msgid "Would you like to reboot now? [y/N]" msgstr "" -#: src/script/arch-update.sh:654 +#: src/script/arch-update.sh:726 #, sh-format msgid "Rebooting in ${sec}...\\r" msgstr "" -#: src/script/arch-update.sh:660 +#: src/script/arch-update.sh:732 #, sh-format msgid "" "An error has occurred during the reboot process\\nThe reboot has been " "aborted\\n" msgstr "" -#: src/script/arch-update.sh:668 +#: src/script/arch-update.sh:740 #, sh-format msgid "" "The reboot hasn't been performed\\nPlease, consider rebooting to finalize " "the pending kernel update\\n" msgstr "" -#: src/script/arch-update.sh:672 +#: src/script/arch-update.sh:744 #, sh-format msgid "No pending kernel update found\\n" msgstr "" -#: src/script/arch-update.sh:727 +#: src/script/arch-update.sh:800 #, sh-format msgid "Example configuration file not found" msgstr "" -#: src/script/arch-update.sh:732 +#: src/script/arch-update.sh:805 #, sh-format msgid "" "The '${config_file}' configuration file already exists\\nPlease, remove it " "before generating a new one" msgstr "" -#: src/script/arch-update.sh:737 +#: src/script/arch-update.sh:810 #, sh-format msgid "The '${config_file}' configuration file has been generated" msgstr "" -#: src/script/arch-update.sh:742 +#: src/script/arch-update.sh:815 #, sh-format msgid "No configuration file found" msgstr "" -#: src/script/arch-update.sh:761 +#: src/script/arch-update.sh:834 #, sh-format msgid "Arch-Update tray desktop file not found" msgstr "" -#: src/script/arch-update.sh:768 +#: src/script/arch-update.sh:841 #, sh-format msgid "The '${tray_desktop_file_autostart}' file already exists" msgstr "" -#: src/script/arch-update.sh:773 +#: src/script/arch-update.sh:846 #, sh-format msgid "" "The '${tray_desktop_file_autostart}' file has been created, the Arch-Update " @@ -509,7 +561,7 @@ msgid "" "from your app menu" msgstr "" -#: src/script/arch-update.sh:781 +#: src/script/arch-update.sh:854 #, sh-format msgid "There's already a running instance of the Arch-Update systray applet" msgstr "" diff --git a/po/fr.po b/po/fr.po index 53350a3..1bb09c1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -218,16 +218,16 @@ msgstr "Aucune mise à jour disponible\\n" msgid "Proceed with update? [Y/n]" msgstr "Procéder à la mise à jour ? [O/n]" -#: src/script/arch-update.sh:327 src/script/arch-update.sh:476 -#: src/script/arch-update.sh:509 src/script/arch-update.sh:551 -#: src/script/arch-update.sh:618 src/script/arch-update.sh:644 +#: src/script/arch-update.sh:327 src/script/arch-update.sh:480 +#: src/script/arch-update.sh:513 src/script/arch-update.sh:555 +#: src/script/arch-update.sh:622 src/script/arch-update.sh:716 #, sh-format msgid "Y" msgstr "O" -#: src/script/arch-update.sh:327 src/script/arch-update.sh:476 -#: src/script/arch-update.sh:509 src/script/arch-update.sh:551 -#: src/script/arch-update.sh:618 src/script/arch-update.sh:644 +#: src/script/arch-update.sh:327 src/script/arch-update.sh:480 +#: src/script/arch-update.sh:513 src/script/arch-update.sh:555 +#: src/script/arch-update.sh:622 src/script/arch-update.sh:716 #, sh-format msgid "y" msgstr "o" @@ -254,7 +254,7 @@ msgid "" "\"enter\" to quit:" msgstr "" "Sélectionnez les news à lire (par exemple: 1 3 5), sélectionnez 0 pour toutes les lire " -"ou appuyez sur \"entrée\" pour quitter:" +"ou appuyez sur \"entrée\" pour quitter :" #: src/script/arch-update.sh:377 #, sh-format @@ -263,7 +263,7 @@ msgid "" "\"enter\" to proceed with update:" msgstr "" "Sélectionnez les news à lire (par exemple: 1 3 5), sélectionnez 0 pour toutes les lire " -"ou appuyez sur \"entrée\" pour procéder à la mise à jour:" +"ou appuyez sur \"entrée\" pour procéder à la mise à jour :" #: src/script/arch-update.sh:399 #, sh-format @@ -290,8 +290,8 @@ msgstr "URL :" msgid "Updating Packages...\\n" msgstr "Mise à jour des paquets...\\n" -#: src/script/arch-update.sh:424 src/script/arch-update.sh:436 -#: src/script/arch-update.sh:447 +#: src/script/arch-update.sh:424 src/script/arch-update.sh:438 +#: src/script/arch-update.sh:451 #, sh-format msgid "" "An error has occurred during the update process\\nThe update has been " @@ -300,27 +300,27 @@ msgstr "" "Une erreur est survenue pendant le processus de mise à jour\\nLa mise à jour a été " "abandonnée\\n" -#: src/script/arch-update.sh:431 +#: src/script/arch-update.sh:433 #, sh-format msgid "Updating AUR Packages...\\n" msgstr "Mise à jour des paquets AUR...\\n" -#: src/script/arch-update.sh:443 +#: src/script/arch-update.sh:447 #, sh-format msgid "Updating Flatpak Packages...\\n" msgstr "Mise à jour des paquets Flatpak...\\n" -#: src/script/arch-update.sh:454 +#: src/script/arch-update.sh:458 #, sh-format msgid "The update has been applied\\n" msgstr "La mise à jour a été appliquée\\n" -#: src/script/arch-update.sh:466 +#: src/script/arch-update.sh:470 #, sh-format msgid "Orphan Packages:" msgstr "Paquets orphelins :" -#: src/script/arch-update.sh:470 +#: src/script/arch-update.sh:474 #, sh-format msgid "" "Would you like to remove this orphan package (and its potential " @@ -329,7 +329,7 @@ msgstr "" "Voulez-vous supprimer ce paquet orphelin (et ses potentielles " "dépendances) maintenant ? [o/N]" -#: src/script/arch-update.sh:472 +#: src/script/arch-update.sh:476 #, sh-format msgid "" "Would you like to remove these orphan packages (and their potential " @@ -338,14 +338,14 @@ msgstr "" "Voulez-vous supprimer ces paquets orphelins (et leurs potentielles " "dépendances) maintenant ? [o/N]" -#: src/script/arch-update.sh:478 +#: src/script/arch-update.sh:482 #, sh-format msgid "Removing Orphan Packages...\\n" msgstr "Suppression des paquets orphelins...\\n" -#: src/script/arch-update.sh:482 src/script/arch-update.sh:515 -#: src/script/arch-update.sh:558 src/script/arch-update.sh:568 -#: src/script/arch-update.sh:578 src/script/arch-update.sh:587 +#: src/script/arch-update.sh:486 src/script/arch-update.sh:519 +#: src/script/arch-update.sh:562 src/script/arch-update.sh:572 +#: src/script/arch-update.sh:582 src/script/arch-update.sh:591 #, sh-format msgid "" "An error has occurred during the removal process\\nThe removal has been " @@ -354,137 +354,196 @@ msgstr "" "Une erreur est survenue pendant le processus de suppression\\nLa suppression a été " "abandonnée\\n" -#: src/script/arch-update.sh:485 src/script/arch-update.sh:518 +#: src/script/arch-update.sh:489 src/script/arch-update.sh:522 #, sh-format msgid "The removal has been applied\\n" msgstr "La suppression a été appliquée\\n" -#: src/script/arch-update.sh:490 src/script/arch-update.sh:522 -#: src/script/arch-update.sh:595 +#: src/script/arch-update.sh:494 src/script/arch-update.sh:526 +#: src/script/arch-update.sh:599 #, sh-format msgid "The removal hasn't been applied\\n" msgstr "La suppression n'a pas été appliquée\\n" -#: src/script/arch-update.sh:494 +#: src/script/arch-update.sh:498 #, sh-format msgid "No orphan package found\\n" msgstr "Aucun paquet orphelin n'a été trouvé\\n" -#: src/script/arch-update.sh:499 +#: src/script/arch-update.sh:503 #, sh-format msgid "Flatpak Unused Packages:" msgstr "Paquets Flatpak inutilisés :" -#: src/script/arch-update.sh:503 +#: src/script/arch-update.sh:507 #, sh-format msgid "Would you like to remove this Flatpak unused package now? [y/N]" msgstr "Voulez-vous supprimer ce paquet Flatpak inutilisé maintenant ? [o/N]" -#: src/script/arch-update.sh:505 +#: src/script/arch-update.sh:509 #, sh-format msgid "Would you like to remove these Flatpak unused packages now? [y/N]" msgstr "Voulez-vous supprimer ces paquets Flatpak inutilisés maintenant ? [o/N]" -#: src/script/arch-update.sh:511 +#: src/script/arch-update.sh:515 #, sh-format msgid "Removing Flatpak Unused Packages..." msgstr "Suppression des paquets Flatpak inutilisés..." -#: src/script/arch-update.sh:526 +#: src/script/arch-update.sh:530 #, sh-format msgid "No Flatpak unused package found\\n" msgstr "Aucun paquet Flatpak inutilisé n'a été trouvé\\n" -#: src/script/arch-update.sh:543 +#: src/script/arch-update.sh:547 #, sh-format msgid "Cached Packages:\\nThere's an old or uninstalled cached package\\n" msgstr "Paquets mis en cache :\\nIl y a un paquet ancien ou désinstallé mis en cache\\n" -#: src/script/arch-update.sh:544 +#: src/script/arch-update.sh:548 #, sh-format msgid "Would you like to remove it from the cache now? [Y/n]" msgstr "Voulez-vous le supprimer du cache maintenant ? [O/n]" -#: src/script/arch-update.sh:546 +#: src/script/arch-update.sh:550 #, sh-format msgid "Cached Packages:\\nThere are old and/or uninstalled cached packages\\n" msgstr "Paquets mis en cache :\\nIl y a plusieurs paquets anciens ou désinstallés mis en cache\\n" -#: src/script/arch-update.sh:547 +#: src/script/arch-update.sh:551 #, sh-format msgid "Would you like to remove them from the cache now? [Y/n]" msgstr "Voulez-vous les supprimer du cache maintenant ? [O/n]" -#: src/script/arch-update.sh:554 src/script/arch-update.sh:574 +#: src/script/arch-update.sh:558 src/script/arch-update.sh:578 #, sh-format msgid "Removing old cached packages..." msgstr "Suppression des anciens paquets mis en cache..." -#: src/script/arch-update.sh:564 src/script/arch-update.sh:583 +#: src/script/arch-update.sh:568 src/script/arch-update.sh:587 #, sh-format msgid "Removing uninstalled cached packages..." msgstr "Suppression des paquets désinstallés mis en cache..." -#: src/script/arch-update.sh:599 +#: src/script/arch-update.sh:603 #, sh-format msgid "No old or uninstalled cached package found\\n" msgstr "Aucun paquet ancien ou désinstallé mis en cache n'a été trouvé\\n" -#: src/script/arch-update.sh:608 +#: src/script/arch-update.sh:612 #, sh-format msgid "Pacnew Files:" msgstr "Fichiers Pacnew :" -#: src/script/arch-update.sh:612 +#: src/script/arch-update.sh:616 #, sh-format msgid "Would you like to process this file now? [Y/n]" msgstr "Voulez-vous traiter ce fichier maintenant ? [O/n]" -#: src/script/arch-update.sh:614 +#: src/script/arch-update.sh:618 #, sh-format msgid "Would you like to process these files now? [Y/n]" msgstr "Voulez-vous traiter ces fichiers maintenant ? [O/n]" -#: src/script/arch-update.sh:620 +#: src/script/arch-update.sh:624 #, sh-format msgid "Processing Pacnew Files...\\n" msgstr "Traitement des fichiers pacnew...\\n" -#: src/script/arch-update.sh:624 +#: src/script/arch-update.sh:628 #, sh-format msgid "The pacnew file(s) processing has been applied\\n" msgstr "Le traitement des fichiers pacnew a été appliqué\\n" -#: src/script/arch-update.sh:627 +#: src/script/arch-update.sh:631 #, sh-format msgid "The pacnew file(s) processing hasn't been applied\\n" msgstr "Le traitement des fichiers pacnew n'a pas été appliqué\\n" -#: src/script/arch-update.sh:631 +#: src/script/arch-update.sh:635 #, sh-format msgid "No pacnew file found\\n" msgstr "Aucun fichier pacnew n'a été trouvé\\n" -#: src/script/arch-update.sh:640 +#: src/script/arch-update.sh:647 +#, sh-format +msgid "Services:\\nThe following service requires a post upgrade restart\\n" +msgstr "Services :\\nLe service suivant requiert un redémarrage suite à sa mise à jour\\n" + +#: src/script/arch-update.sh:649 +#, sh-format +msgid "Services:\\nThe following services require a post upgrade restart\\n" +msgstr "Services :\\nLes services suivants requièrent un redémarrage suite à leur mise à jour\\n" + +#: src/script/arch-update.sh:659 +#, sh-format +msgid "" +"Select the service(s) to restart (e.g. 1 3 5), select 0 to restart them all " +"or press \"enter\" to continue without restarting the service(s):" +msgstr "" +"Sélectionnez le(s) service(s) à redémarrer (par exemple: 1 3 5); sélectionnez 0 pour tous les redémarrer " +"ou appuyez sur \"entrée\" pour continuer sans redémarrer le(s) service(s) :" + +#: src/script/arch-update.sh:665 src/script/arch-update.sh:692 +#, sh-format +msgid "Service(s) restarted successfully\\n" +msgstr "Service(s) redémarré(s) avec succès\\n" + +#: src/script/arch-update.sh:668 src/script/arch-update.sh:695 +#, sh-format +msgid "" +"An error has occurred during the service(s) restart\\nPlease, verify the " +"above service(s) status\\n" +msgstr "" +"Une erreur est survenue pendant le redémarrage du/des service(s)\\n Veuillez vérifier " +"le statut des services ci-dessus\\n" + +#: src/script/arch-update.sh:681 +#, sh-format +msgid "The ${service_selected} service has been successfully restarted" +msgstr "Le service ${service_selected} a été redémarré avec succès" + +#: src/script/arch-update.sh:683 +#, sh-format +msgid "" +"An error has occurred during the restart of the ${service_selected} service" +msgstr "" +"Une erreur est survenue pendant le redémarrage du service ${service_selected}" + +#: src/script/arch-update.sh:699 +#, sh-format +msgid "" +"The service(s) restart hasn't been performed\\nPlease, consider restarting " +"services that have been updated to fully apply the upgrade\\n" +msgstr "" +"Le redémarrage du/des service(s) n'a pas été appliqué\\nVeuillez considérer redémarrer " +"les services qui ont été mis à jour pour appliquer complètement la mise à niveau\\n" + +#: src/script/arch-update.sh:703 +#, sh-format +msgid "No service requiring a post upgrade restart found\\n" +msgstr "Aucun service nécessitant un redémarrage suite à la mise à jour n'a été trouvé\\n" + +#: src/script/arch-update.sh:712 #, sh-format msgid "" "Reboot required:\\nThere's a pending kernel update on your system requiring " "a reboot to be applied\\n" msgstr "" -"Redémarrage nécessaire :\\nIl y a une mise à jour du noyau en attente sur votre système qui nécessite " +"Redémarrage nécessaire :\\nIl y a une mise à jour du noyau en attente sur votre système qui nécessite " "un redémarrage pour être appliquée\\n" -#: src/script/arch-update.sh:641 +#: src/script/arch-update.sh:713 #, sh-format msgid "Would you like to reboot now? [y/N]" msgstr "Voulez-vous redémarrer votre système maintenant ? [o/N]" -#: src/script/arch-update.sh:654 +#: src/script/arch-update.sh:726 #, sh-format msgid "Rebooting in ${sec}...\\r" msgstr "Redémarrage dans ${sec}...\\r" -#: src/script/arch-update.sh:660 +#: src/script/arch-update.sh:732 #, sh-format msgid "" "An error has occurred during the reboot process\\nThe reboot has been " @@ -493,7 +552,7 @@ msgstr "" "Une erreur est survenue pendant le processus de redémarrage\\nLe redémarrage a été " "abandonné\\n" -#: src/script/arch-update.sh:668 +#: src/script/arch-update.sh:740 #, sh-format msgid "" "The reboot hasn't been performed\\nPlease, consider rebooting to finalize " @@ -502,17 +561,17 @@ msgstr "" "Le redémarrage n'a pas été effectué\\nVeuillez considérer redémarrer votre système pour finaliser " "la mise à jour du noyau en attente\\n" -#: src/script/arch-update.sh:672 +#: src/script/arch-update.sh:744 #, sh-format msgid "No pending kernel update found\\n" msgstr "Aucune mise à jour du noyau en attente n'a été trouvée\\n" -#: src/script/arch-update.sh:727 +#: src/script/arch-update.sh:800 #, sh-format msgid "Example configuration file not found" msgstr "Fichier de configuration exemple non trouvé" -#: src/script/arch-update.sh:732 +#: src/script/arch-update.sh:805 #, sh-format msgid "" "The '${config_file}' configuration file already exists\\nPlease, remove it " @@ -521,27 +580,27 @@ msgstr "" "Le fichier de configuration '${config_file}' existe déjà.\\nVeuillez le supprimer " "avant d'en générer un nouveau" -#: src/script/arch-update.sh:737 +#: src/script/arch-update.sh:810 #, sh-format msgid "The '${config_file}' configuration file has been generated" msgstr "Le fichier de configuration '${config_file}' a été généré" -#: src/script/arch-update.sh:742 +#: src/script/arch-update.sh:815 #, sh-format msgid "No configuration file found" msgstr "Aucun fichier de configuration n'a été trouvé" -#: src/script/arch-update.sh:761 +#: src/script/arch-update.sh:834 #, sh-format msgid "Arch-Update tray desktop file not found" msgstr "Le fichier Arch-Update tray desktop n'a pas été trouvé" -#: src/script/arch-update.sh:768 +#: src/script/arch-update.sh:841 #, sh-format msgid "The '${tray_desktop_file_autostart}' file already exists" msgstr "Le fichier '${tray_desktop_file_autostart}' existe déjà" -#: src/script/arch-update.sh:773 +#: src/script/arch-update.sh:846 #, sh-format msgid "" "The '${tray_desktop_file_autostart}' file has been created, the Arch-Update " @@ -554,7 +613,7 @@ msgstr "" "immédiatement, vous pouvez lancer l'application \"Arch-Update Systray Applet\" " "depuis votre menu d'application" -#: src/script/arch-update.sh:781 +#: src/script/arch-update.sh:854 #, sh-format msgid "There's already a running instance of the Arch-Update systray applet" msgstr "Il y a déjà une instance de l'applet systray d'Arch-Update en cours d'exécution" diff --git a/src/script/arch-update.sh b/src/script/arch-update.sh index 77d9bee..5ea4fd0 100755 --- a/src/script/arch-update.sh +++ b/src/script/arch-update.sh @@ -423,6 +423,8 @@ update() { echo error_msg "$(eval_gettext "An error has occurred during the update process\nThe update has been aborted\n")" && quit_msg exit 5 + else + packages_updated="y" fi fi @@ -435,6 +437,8 @@ update() { echo error_msg "$(eval_gettext "An error has occurred during the update process\nThe update has been aborted\n")" && quit_msg exit 5 + else + packages_updated="y" fi fi @@ -632,6 +636,74 @@ pacnew_files() { fi } +# Definition of the restart_services function: Verify if any services require a post update restart +restart_services() { + if [ -n "${packages_updated}" ]; then + services=$(yes No | sudo checkservices -FP 2> /dev/null | grep ".service" | grep -v -e "dbus-broker.service" -e "systemd-logind.service" -e "gdm.service" -e "sddm.service" -e "lightdm.service" -e "lxdm.service" -e "slim.service" -e "xdm.service" -e "greetd.service" -e "nodm.service" -e "ly.service" -e "lemurs.service" | cut -f2 -d "'") + services_num=$(echo "${services}" | wc -l) + + if [ -n "${services}" ]; then + if [ "${services_num}" -eq 1 ]; then + main_msg "$(eval_gettext "Services:\nThe following service requires a post upgrade restart\n")" + else + main_msg "$(eval_gettext "Services:\nThe following services require a post upgrade restart\n")" + fi + + i=1 + while IFS= read -r line; do + echo "${i} - ${line}" + ((i=i+1)) + done < <(printf '%s\n' "${services}") + + echo + ask_msg_array "$(eval_gettext "Select the service(s) to restart (e.g. 1 3 5), select 0 to restart them all or press \"enter\" to continue without restarting the service(s):")" + echo + + if [ "${answer_array[0]}" -eq 0 ] 2> /dev/null; then + # shellcheck disable=SC2086 + if "${su_cmd}" systemctl restart ${services}; then + info_msg "$(eval_gettext "Service(s) restarted successfully\n")" + + else + error_msg "$(eval_gettext "An error has occurred during the service(s) restart\nPlease, verify the above service(s) status\n")" && quit_msg + exit 11 + fi + else + array_to_string=$(printf "%s\n" "${answer_array[@]}") + mapfile -t answer_array < <(echo "${array_to_string}" | awk '!seen[$0]++') + + for num in "${answer_array[@]}"; do + if [ "${num}" -le "${services_num}" ] 2> /dev/null && [ "${num}" -gt "0" ]; then + service_restarted="y" + service_selected=$(sed -n "${num}"p <<< "${services}") + + if "${su_cmd}" systemctl restart "${service_selected}"; then + info_msg "$(eval_gettext "The \${service_selected} service has been successfully restarted")" + else + error_msg "$(eval_gettext "An error has occurred during the restart of the \${service_selected} service")" + service_fail="y" + fi + fi + done + + if [ -n "${service_restarted}" ]; then + if [ -z "${service_fail}" ]; then + echo + info_msg "$(eval_gettext "Service(s) restarted successfully\n")" + else + echo + error_msg "$(eval_gettext "An error has occurred during the service(s) restart\nPlease, verify the above service(s) status\n")" && quit_msg + exit 11 + fi + else + warning_msg "$(eval_gettext "The service(s) restart hasn't been performed\nPlease, consider restarting services that have been updated to fully apply the upgrade\n")" + fi + fi + else + info_msg "$(eval_gettext "No service requiring a post upgrade restart found\n")" + fi + fi +} # Definition of the kernel_reboot function: Verify if there's a kernel update waiting for a reboot to be applied kernel_reboot() { kernel_compare=$(file /boot/vmlinuz* /usr/lib/modules/*/vmlinuz* | sed 's/^.*version\ //' | awk '{print $1}' | grep "$(uname -r)") @@ -684,6 +756,7 @@ full_upgrade() { orphan_packages packages_cache pacnew_files + restart_services kernel_reboot quit_msg }