install: allow instantiated units to be enabled via presets
authorRuixin Bao <rubao@redhat.com>
Tue, 21 Aug 2018 20:40:56 +0000 (20:40 +0000)
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Tue, 24 Nov 2020 18:01:43 +0000 (19:01 +0100)
commit4c41ad9418058aefb2d2732b0b65da9c7cdf5151
tree15871b1b85095710cb5763ec70f26afe64011ec0
parent5813180a75aa1ef90f6d3459fc5beb099b815cfb
install: allow instantiated units to be enabled via presets

This patch implements https://github.com/systemd/systemd/issues/9421.

The .preset file now is able to take a rule in the format of:(e.g)
enable foo@.service bar0 bar1 bar2

In the above example, when preset-all is called, all three instances of
foo@bar0.service, foo@bar1.service and foo@bar2.service will be enabled.

When preset is called on a single service(e.g: foo@bar1.service), only
the mentioned one(foo@bar1.service) will be enabled.

Tests are added for future regression.

(cherry picked from commit 4c9565eea534cd233a913c8c21f7920dba229743)

Resolves: #1812972
src/shared/install.c
src/test/test-install-root.c