Bug#772555: untested hacky attempt at using systemctl preset

Andreas Henriksson andreas at fatal.se
Wed Mar 2 17:24:56 GMT 2016


Control: tags -1 + patch

Hello again.

On Tue, Mar 01, 2016 at 05:42:19PM +0100, Andreas Henriksson wrote:
> Hello!
> 
> I'm attaching a completely untested attempt at prefering "systemctl
> preset" over just enabling unconditionally.
[...]

Ok, I actually tested it now and except for a minor mistake (added '== 0'
to 'system(...) == 0 or error "...";') it actually seems to work.
Updated patch attached.

Tested under both sysvinit-core (with systemctl available = systemd
package installed) and under systemd-sysv (pid1 = systemd).
(Under sysvinit-core without systemctl/systemd package installed is
just assumed to still work since it's all old code as usual then.)

Testcases used was hdparm (ships init script but no native service file)
and fancontrol (ships both init script and native service file).

Please note that perl warns about the smartmatch being experimental.
Someone should probably replace that part with a better check....

Please also note that if you actually add a preset file which disables
the service (eg. echo "disable *" >> \
/lib/systemd/system-preset/test.preset ) you'll get confusing message
(from systemctl preset) saying the service file has no Install section.

Anyway, it works! Ship it! ;)

Regards,
Andreas Henriksson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dsh-preset2.patch
Type: text/x-diff
Size: 3790 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20160302/3c6a947b/attachment.patch>


More information about the Pkg-systemd-maintainers mailing list