logind: implement maintenance window
Update frameworks that work automatically in the background occasionally need to schedule reboots. Systemd-logind already provides a nice mechanism to schedule shutdowns, send notfications and block logins short before the time. Systemd has a framework for calendar events, so we may conveniently use logind to define a maintenance window for reboots.
The existing ScheduleShutdown DBus method in logind expects a usec_t with an absolute time. So it would be possible to use 0 as magic value telling logind to take the time from the maintenance window if set. That would be really easy for programs to pass.
I'd like to have this working for the shutdown command too though so e.g "shutdown -r" would use the maintenance window automatically instead of the one minute default. Unfortunately internally systemctl treats 0 as no scheduled shutdown, so we have to use USEC_INFINITY instead.
hmm, i don't grok the usecase for this? can you elaborate how an OS is supposed to use this? i guess I am missing the context here?
This is basically porting the only relevant remaining feature of https://github.com/SUSE/rebootmgr to logind. The use case is to allow to define a specific time when a machine should reboot in case updates were staged. So the program installing the updates would call something like busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager ScheduleShutdown st reboot 0 and depending on setting would either reboot right away or at the defined maintenance window.
Thanks for your review! I've adjusted the code as you suggested
[!IMPORTANT] An -rc1 tag has been created and a release is being prepared, so please note that PRs introducing new features and APIs will be held back until the new version has been released.
updated according to review. Agreeing on the actual naming is still open
Please rebase.
rebased
finally got back to this. pr updated
updated
Looks great, just some naming stuff.
Also please rebase.
fixed and rebased