Hello everyone!
You might have encountered a situation where on a particular day, you might not know if you actually need to reboot or not. You might want to reboot if a newer generation has a newer version of Linux/Systemd. It is currently limited only to Linux and Systemd since I think those are the only two pieces of software critical enough worth rebooting .
This is a hacked together program that checks the versions (not binaries) of current and whatever the newest generation is and creates a file called /var/run/reboot-required
(superuser privileges required, of course) if you do need to reboot.
A handy trick I employ is to check for this file from my bashrc, that way, whenever the prompt updates, I am reminded of updating at the earliest.
āDoesnāt this already exist with system.autoUpgrade.allowReboot
?ā
Yes and no.
If I understand the system.autoUpgrade.allowReboot
script correctly, it determines that based on path mismatch. Sometimes, thatās not the case. Maybe this is just me but I have sometimes noticed duplicate kernel paths in /nix/store
with no real difference (that I could find). Like the following:
$ nvd diff $(readlink /nix/var/nix/profiles/system/kernel) $(readlink /run/booted-system/kernel) 2>&1 | tee nvddiff
<<< /nix/store/m2ilvardlmn0gw9nlbd6r65pn6swilg4-linux-6.7.6/Image
>>> /nix/store/asazm97mz1zzi1cyw2x9cgdy35dgzcw6-linux-6.7.6/Image
No version or selection state changes.
Closure size: 1 -> 1 (1 paths added, 1 paths removed, delta +0, disk usage +0B).
In this case, you donāt really need to reboot. The versions are same, only difference is in the kernel image itself, not even the DTBs and modules.
An advantage of this program over that script is that all it does is read, and then only if you need to upgrade, create an empty file called /var/run/reboot-required
. It doesnāt actually reboot. This is perfect for when you want to be ānotifiedā instead of reboot at night after the auto-upgrade.
For several months, Iāve been the sole consumer but thought of uploading it to GitHub today and might as well do it properly, so here you go.
Happy to accept any issues/[critical] feedback/PRs! :)