[systemd-devel] What unit file should I depend on?

Mike Kazantsev mk.fraggod at gmail.com
Wed Feb 1 04:20:43 PST 2012

On Wed, 01 Feb 2012 03:40:20 -0800
Manuel Amador <rudd-o at rudd-o.com> wrote:

> Thanks for the info.
> What I mean to do is create a unit file that, dropped in, will automatically 
> run on boot without having to enable anything.  Let's be specific:
> [Unit]
> Blah blah blah
> After=cryptsetup.target fedora-storage-init-late.service local-fs.target
> WantedBy=local-fs.target

Afaik WantedBy= is only valid in the [Install] section.

> Such that the act of starting local-fs.target runs my unit, without me having 
> to systemctl enable the unit in question.
> In other words:
> - I want local-fs.target to "pull in" my unit without having to touch local-
> fs.target to add a Requires= dependency,

That's what enable does by by putting a symlink to local-fs.target.wants
directory. Just make something (package?) install that symlink along
with the unit file.
Note that you can put it into /lib/systemd/system/local-fs.target.wants
instead of /etc, so it won't conflict with site-local changes.

Some macro can probably be used in rpm .spec files to enable unit on
package installation, probably via the same mechanism as "systemctl
preset" uses.

> - I don't want the local-fs.target to be "reached" until my own unit is done 
> mounting filesystems,

Then you need Before=local-fs.target, not After=local-fs.target.

> - I don't want my unit file to execute before the late block device 
> initialization is done,
> Catch my drift?

Mike Kazantsev // fraggod.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20120201/f3dfad2b/attachment.pgp>

More information about the systemd-devel mailing list