diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-10 21:33:25 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-29 16:17:56 +0200 |
commit | 17a2679e9925c9ec3c5764d01def92c5627973e4 (patch) | |
tree | af33af998cb5af92dd5706f8bdb0a5f1112d1a94 /test | |
parent | shared/install: also check for self-aliases during installation and ignore them (diff) | |
download | systemd-17a2679e9925c9ec3c5764d01def92c5627973e4.tar.xz systemd-17a2679e9925c9ec3c5764d01def92c5627973e4.zip |
man: fix invalid description of template handling in WantedBy=
We don't need to talk about Alias=. The approach of using Alias= to enable
units is still supported, but hasn't been advertised as the way to do thing
for many years. Using it as an explanation is just confusing.
Also, the description of templated units did not take DefaultInstance=
into account. It is updated and extended.
Diffstat (limited to 'test')
-rw-r--r-- | test/test-systemctl-enable.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/test-systemctl-enable.sh b/test/test-systemctl-enable.sh index 4117436462..3aa61222a8 100644 --- a/test/test-systemctl-enable.sh +++ b/test/test-systemctl-enable.sh @@ -324,6 +324,31 @@ test ! -h "$root/etc/systemd/system/services.target.wants/templ1@333.service" test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service" test ! -h "$root/etc/systemd/system/services.target.wants/templ1@two.service" +: -------template enablement for another template------------- +cat >"$root/etc/systemd/system/templ2@.service" <<EOF +[Install] +RequiredBy=another-template@.target +EOF + +"$systemctl" --root="$root" enable 'templ2@.service' +islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service" + +"$systemctl" --root="$root" enable 'templ2@two.service' +islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service" +islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "/etc/systemd/system/templ2@.service" + +"$systemctl" --root="$root" disable 'templ2@other.service' +islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service" +islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "/etc/systemd/system/templ2@.service" + +"$systemctl" --root="$root" disable 'templ2@two.service' +islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service" +test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" + +"$systemctl" --root="$root" disable 'templ2@.service' +test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" +test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" + : -------aliases w/ and w/o instance-------------------------- test ! -e "$root/etc/systemd/system/link4.service" cat >"$root/etc/systemd/system/link4.service" <<EOF @@ -529,6 +554,30 @@ check_alias % '%' && { echo "Expected failure because % is not legal in unit nam check_alias z 'z' && { echo "Expected failure because %z is not known" >&2; exit 1; } +: -------specifiers in WantedBy------------------------------- +# We don't need to repeat all the tests. Let's do a basic check that specifier +# expansion is performed. + +cat >"$root/etc/systemd/system/some-some-link7.socket" <<EOF +[Install] +WantedBy=target@%p.target +WantedBy=another-target@.target +RequiredBy=target2@%p.target +RequiredBy=another-target2@.target +EOF + +"$systemctl" --root="$root" enable 'some-some-link7.socket' +islink "$root/etc/systemd/system/target@some-some-link7.target.wants/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket" +islink "$root/etc/systemd/system/another-target@.target.wants/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket" +islink "$root/etc/systemd/system/target2@some-some-link7.target.requires/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket" +islink "$root/etc/systemd/system/another-target2@.target.requires/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket" + +"$systemctl" --root="$root" disable 'some-some-link7.socket' +test ! -h "$root/etc/systemd/system/target@some-some-link7.target.wants/some-some-link7.socket" +test ! -h "$root/etc/systemd/system/another-target@.target.wants/some-some-link7.socket" +test ! -h "$root/etc/systemd/system/target2@some-some-link7.target.requires/some-some-link7.socket" +test ! -h "$root/etc/systemd/system/another-target2@.target.requires/some-some-link7.socket" + # TODO: repeat the tests above for presets : -------SYSTEMD_OS_RELEASE relative to root------------------ |