shared/install: fix DefaultInstance expansion in %n, %N
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:28:46 +0000 (09:28 -0400)
commitcfd559c9a8bc398ce03d604957fa31fbbcaef2ef
tree3de20bd1fad786554a73d9060c6f897a570e1a2e
parent6e3136b209679d88c4347ce2f6d5e22c031e4d3e
shared/install: fix DefaultInstance expansion in %n, %N

We should substitute DefaultInstance if the instance is not specified.

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

$ systemctl --root=/ enable testing4@.service
Created symlink /etc/systemd/system/foobar-n-testing4@bond1.service.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.
Created symlink /etc/systemd/system/foobar-N-testing4@bond1.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.

(before, the symlink would be created with empty %n, %N parts).
src/shared/install-printf.c