[systemd-devel] Question about system-update.target
Lennart Poettering
lennart at poettering.net
Mon Apr 27 08:42:03 PDT 2015
On Mon, 27.04.15 15:47, Richard Hughes (hughsient at gmail.com) wrote:
> On 27 April 2015 at 15:18, Lennart Poettering <lennart at poettering.net> wrote:
> > Well, thinking about this, maybe OnFailure=reboot.target is missing
> > the point for these services. After all, the system should reboot
> > regardless if the update fails or not...
>
> Not quite; PackageKit supports an update-offline-and-then-shutdown
> mode at the request of the GNOME designers. If we can configure that
> using systemd I'd gladly rip out the code in PackageKit and move it
> down to systemd.
Hmm, in that case I think this is best done as part of PackageKit really...
Something like this:
- ship a service packagekit-reboot.service that contains:
[Service]
ExecStart=/bin/systemctl reboot --no-block
Type=oneshot
- ship a service packagekit-poweroff.service that contains:
[Service]
ExecStart=/bin/systemctl poweroff --no-block
Type=oneshot
Then, order both your update services
"Before=packagegit-reboot.service packagekit-poweroff.service", so
that they run before those services are started.
Finally, from packagekit, enqueue pretty early on, before you start
installation either one or the other of the two services, depending on
packagkit's configuration. This is easily done by issuing the
StartUnit() bus call on the systemd service file passing either
"packagekit-reboot.service" or "packagekit-poweroff.service" as first
parameter, and "replace" as second.
That way you can keep the setting hwether to reboot or poweroff in
packagekit. And make sure to enqueu the jobs really early on, so that
they are enqueued whatever happens. the deps will make sure that they
aren't run before your two updat services actually finish running.
I hope that makes sense?
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list