Some system updates will require you to restart your system. Packages includes microcode, kernel, driver, xorg and systemd as likely candidates. Below is a list of packages which may warrent a system restart. If you can think of other packages to include in the check just add the package(s) to the $reboot regex in the script.
The script calls the
checkupdates script - and
yay if installed - and uses regular expression to suggest a possible system restart.
#!/usr/bin/env bash reboot="(ucode|cryptsetup|linux|nvidia|mesa|systemd|wayland|xf86-video|xorg)" if [[ $(which yay) =~ (yay) ]]; then updates=$(checkupdates; yay -Qua) else updates=$(checkupdates) fi echo "$updates" if [[ $updates =~ $reboot ]]; then echo "Updating possibly requires system restart ..." fi
As noted in comments the check is very broad and not intended by any means to be authoritative - it only serves the purpose of suggesting - before updates are installed - if system restart could be necessary.
Inspiration from @Kresimir and EndeavourOS forum   and the resulting script 
Posted at Manjaro Form