Skip to content

Commit

Permalink
feat: Check for services that require a post upgrade restart on packa…
Browse files Browse the repository at this point in the history
…ges 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 bus1/dbus-broker#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 #181
  • Loading branch information
Antiz96 committed Jul 7, 2024
1 parent 3683b4a commit d2af4a8
Show file tree
Hide file tree
Showing 7 changed files with 316 additions and 120 deletions.
8 changes: 5 additions & 3 deletions README-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand All @@ -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 :
Expand Down Expand Up @@ -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).
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand All @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion doc/man/arch-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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),
Expand Down
6 changes: 5 additions & 1 deletion doc/man/fr/arch-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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),
Expand Down
Loading

0 comments on commit d2af4a8

Please sign in to comment.