Systemd tip: service conditionals

Lennart Poettering mzerqung at 0pointer.de
Tue May 21 14:12:48 UTC 2013


On Tue, 21.05.13 14:08, Simone Caronni (negativo17 at gmail.com) wrote:

> Hello,
> 
> thanks for the tip.
> 
> On 16 May 2013 20:41, Adam Williamson <awilliam at redhat.com> wrote:
> 
> > It's really neat stuff, and very easy to use: you just add a
> > Condition(Something) statement to the .service file. For details on
> > using these conditions, see 'man systemd.unit' and just search for
> > Condition, and you'll find a list of all the available Conditions and
> > how to use them.
> >
> 
> I have a question though, what is the best option in your opinion for a
> service that should start only on a UEFI based system?

/sys/firmware/efi only exists on EFI boots. In systemd you hence may use:

ConditionPathExists=/sys/firmware/efi

> If there's a way to check if Secure Boot is enabled that would be
> great.

There is an EFI var for that, but with systemd conditions you can only
check for existance of EFI vars, not values, so this is currently not
doable with systemd nicely.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the devel mailing list