shared/install: fix DefaultInstance expansion in %i
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Oct 2016 04:27:46 +0000 (00:27 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Oct 2016 13:12:42 +0000 (09:12 -0400)
commit6e3136b209679d88c4347ce2f6d5e22c031e4d3e
treed9148b74b9236bca3e156238348abb5fe7204995
parent5368222db6093195dbbd5fc7418508b154b1b769
shared/install: fix DefaultInstance expansion in %i

We should substitute DefaultInstance if the instance is not specified.

Test case:
[Install]
DefaultInstance=bond1
WantedBy= foobar-i-%i.device

$ systemctl --root=/ enable testing4@.service
Created symlink /etc/systemd/system/foobar-i-bond1.device.wants/testing4@bond1.service
 → /etc/systemd/system/testing4@.service.
(before, the symlink would be created as
/etc/systemd/system/foobar-i-.device.wants/testing4@bond1.service)

Fixes #4411.
src/shared/install-printf.c