[systemd-devel] [RFC] Preset Files

Marius Tolzmann tolzmann at molgen.mpg.de
Tue Jul 5 15:18:58 PDT 2011


moin moin..

I am not really a distributor but I like the idea..

Currently we are using a small tool which starts/stops services based on 
the hostname, e.g. on host 'www' start apache and on host 'mail' start 
postfix.. So services are not enabled by default but just started on 
demand.. The tool decides on the fly which services should be started on 
this host.. this tool is currently based on sysv init scripts and not 
yet adopted to systemd..

Explaining this i just want to point to another use case for this 
feature.. since setting up a presets for a specific use case sounds 
easier than encoding it in usecase1.target usecase2.target..

but i have some questions about those presets..

On 05.07.2011 21:21, Lennart Poettering wrote:
> More specifically this is how it should work: We'd have a directory
> /lib/systemd/system.preset/. By default it would be empty (or not even
> exist), which for simplicity reasons would mean "enable everything
> installed" (i.e. the Debian policy). Then, if distros or spins want to
> change what is enabled by default, they'd drop in a file (or multiple,
> which might be useful for a desktop spin and a graphical design spin
> where the latter is a superset of the former) in that
> directory. The file would be a trivial text file with lines like this:
>
> <snip>
> disable avahi-daemon.service
> enable cups.service
> disable *
> </snip>

Are all of the files dropped into the system.preset/ directory loaded in 
alphabetic order and then merged? (like udev/rules.d ?)

Will unit files that lack an [Install] section will be skipped when 
defining 'disable *'? (e.g. all systemd default units etc.)

> If "systemctl preset" is passed with unit names, those units would
> be enable/disabled as listed in the preset file. If no argument is
> passed all units would be reset to the preset defaults. (another
> long-sought feature...)

Am I right that invoking 'systemctl preset' will enable all currently 
disabled services if i do not write a preset file? wouldn't it be better 
to just enable/disable services that are explicitly listed in the preset 
files if no argument is passed?

The Distributor/Admin could easily change this to "enable-by-default" by 
adding "enable *".

So I can't break my current setup by accidentally invoking 'systemctl 
preset' on purpose 8)

('systemctl preset <unit>' should still enable <unit> even if no preset 
is defined at all)

bye marius..


-- 
Dipl.-Inf. Marius Tolzmann <marius.tolzmann at molgen.mpg.de>
----------------------------------.------------------------------
MPI f. molekulare Genetik         |
Ihnestrasse 63-73, D-14195 Berlin |   ==> MarIuX GNU/Linux <==
Phone: +49 (0)30 8413 1709        |
----------------------------------^------------------------------
God put me on earth to accomplish a certain number of things.
Right now I am so far behind..
    ..I will never die.         <by calvin from calvin&hobbes ;)>


More information about the systemd-devel mailing list