summaryrefslogtreecommitdiffstats
path: root/test/test-systemctl-enable.sh
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-04-12 22:01:10 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-05 19:02:26 +0200
commit9aa3d6b41eadff6634bb3cf800064724171a7aad (patch)
tree7a9da0cb85ce265adb7c2ff5a5d8b6c97a909258 /test/test-systemctl-enable.sh
parentAmend documentation for LimitNPROC= (diff)
downloadsystemd-9aa3d6b41eadff6634bb3cf800064724171a7aad.tar.xz
systemd-9aa3d6b41eadff6634bb3cf800064724171a7aad.zip
Revert "shared/install: create relative symlinks for enablement and aliasing"
This reverts commit d6c9411072901556176ac130f2ce71a33107aa93. I still think this is something that needs to be done, but we're hitting some unexplained failures, e.g. https://github.com/systemd/systemd/issues/22920. So let's revert this for now, so -rc2 can be released, with a plan to return to this after a release. Closes #22920.
Diffstat (limited to 'test/test-systemctl-enable.sh')
-rw-r--r--test/test-systemctl-enable.sh130
1 files changed, 67 insertions, 63 deletions
diff --git a/test/test-systemctl-enable.sh b/test/test-systemctl-enable.sh
index f40831cf8c..7d5667f297 100644
--- a/test/test-systemctl-enable.sh
+++ b/test/test-systemctl-enable.sh
@@ -90,27 +90,27 @@ EOF
( ! "$systemctl" --root="$root" enable test1 )
test -h "$root/etc/systemd/system/default.target.wants/test1.service"
test -h "$root/etc/systemd/system/special.target.requires/test1.service"
-test -e "$root/etc/systemd/system/test1-goodalias.service"
+test ! -e "$root/etc/systemd/system/test1-goodalias.service"
test -h "$root/etc/systemd/system/test1-goodalias.service"
-test ! -h "$root/etc/systemd/system/test1@badalias.service"
-test ! -h "$root/etc/systemd/system/test1-badalias.target"
-test ! -h "$root/etc/systemd/system/test1-badalias.socket"
-test -e "$root/etc/systemd/system/test1-goodalias2.service"
+test ! -e "$root/etc/systemd/system/test1@badalias.service"
+test ! -e "$root/etc/systemd/system/test1-badalias.target"
+test ! -e "$root/etc/systemd/system/test1-badalias.socket"
test -h "$root/etc/systemd/system/test1-goodalias2.service"
: '-------aliases in reeanble----------------------------------'
( ! "$systemctl" --root="$root" reenable test1 )
-islink "$root/etc/systemd/system/default.target.wants/test1.service" "../test1.service"
-islink "$root/etc/systemd/system/test1-goodalias.service" "test1.service"
+test -h "$root/etc/systemd/system/default.target.wants/test1.service"
+test ! -e "$root/etc/systemd/system/test1-goodalias.service"
+test -h "$root/etc/systemd/system/test1-goodalias.service"
-test ! -h "$root/etc/systemd/system/test1@badalias.service"
-test ! -h "$root/etc/systemd/system/test1-badalias.target"
-test ! -h "$root/etc/systemd/system/test1-badalias.socket"
+test ! -e "$root/etc/systemd/system/test1@badalias.service"
+test ! -e "$root/etc/systemd/system/test1-badalias.target"
+test ! -e "$root/etc/systemd/system/test1-badalias.socket"
"$systemctl" --root="$root" disable test1
-test ! -h "$root/etc/systemd/system/default.target.wants/test1.service"
-test ! -h "$root/etc/systemd/system/special.target.requires/test1.service"
-test ! -h "$root/etc/systemd/system/test1-goodalias.service"
+test ! -e "$root/etc/systemd/system/default.target.wants/test1.service"
+test ! -e "$root/etc/systemd/system/special.target.requires/test1.service"
+test ! -e "$root/etc/systemd/system/test1-goodalias.service"
: '-------aliases when link already exists---------------------'
cat >"$root/etc/systemd/system/test1a.service" <<EOF
@@ -201,17 +201,17 @@ test ! -e "$root/etc/systemd/system/link1.path"
: '-------link and enable--------------------------------------'
"$systemctl" --root="$root" enable '/link1.path'
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
: '-------enable already linked same path----------------------'
"$systemctl" --root="$root" enable '/link1.path'
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
: '-------enable already linked different path-----------------'
( ! "$systemctl" --root="$root" enable '/subdir/link1.path' )
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
: '-------enable bad suffix------------------------------------'
cp "$root/link1.path" "$root/subdir/link1.suffix"
@@ -240,11 +240,11 @@ test ! -h "$root/etc/systemd/system/paths.target.wants/link1.path"
"$systemctl" --root="$root" enable 'link1.path'
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
"$systemctl" --root="$root" reenable 'link1.path'
islink "$root/etc/systemd/system/link1.path" "/link1.path"
-islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
+islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path"
: '-------manual link------------------------------------------'
cat >"$root/link3.suffix" <<EOF
@@ -257,7 +257,7 @@ ln -s "/link3.suffix" "$root/etc/systemd/system/link3.service"
SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_LOCATION=1 "$systemctl" --root="$root" enable 'link3.service'
islink "$root/etc/systemd/system/link3.service" "/link3.suffix"
-islink "$root/etc/systemd/system/services.target.wants/link3.service" "../link3.service"
+islink "$root/etc/systemd/system/services.target.wants/link3.service" "/link3.suffix"
SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_LOCATION=1 "$systemctl" --root="$root" disable 'link3.service'
test ! -h "$root/etc/systemd/system/link3.service"
@@ -293,7 +293,7 @@ test ! -h "$root/etc/systemd/system/services.target.wants/link5-also.service"
"$systemctl" --root="$root" enable 'link5-also.service'
test ! -h "$root/etc/systemd/system/services.target.wants/link5.service"
-islink "$root/etc/systemd/system/services.target.wants/link5-also.service" "../link5-also.service"
+islink "$root/etc/systemd/system/services.target.wants/link5-also.service" "/etc/systemd/system/link5-also.service"
: '-------template enablement----------------------------------'
cat >"$root/etc/systemd/system/templ1@.service" <<EOF
@@ -307,17 +307,17 @@ test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
"$systemctl" --root="$root" enable 'templ1@one.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "../templ1@one.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" enable 'templ1@two.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "../templ1@one.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "../templ1@two.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" disable 'templ1@one.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "../templ1@two.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" disable 'templ1@two.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
@@ -335,33 +335,33 @@ EOF
"$systemctl" --root="$root" enable 'templ1@.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "../templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" enable 'templ1@one.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "../templ1@one.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "../templ1@one.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" enable 'templ1@two.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "../templ1@one.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "../templ1@one.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "../templ1@two.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "../templ1@two.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "/etc/systemd/system/templ1@.service"
"$systemctl" --root="$root" disable 'templ1@one.service'
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "../templ1@.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "../templ1@.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service"
test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service"
test ! -h "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service"
-islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "../templ1@two.service"
-islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "../templ1@two.service"
+islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service"
+islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "/etc/systemd/system/templ1@.service"
# disable remaining links here
"$systemctl" --root="$root" disable 'templ1@.service'
@@ -400,18 +400,18 @@ RequiredBy=another-template@.target
EOF
"$systemctl" --root="$root" enable 'templ2@.service'
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "../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" "../templ2@.service"
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "../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" "../templ2@.service"
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "../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@two.service'
-islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "../templ2@.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'
@@ -433,8 +433,8 @@ EOF
test ! -h "$root/etc/systemd/system/link4.service" # this is our file
test ! -h "$root/etc/systemd/system/link4@.service"
test ! -h "$root/etc/systemd/system/link4@inst.service"
-islink "$root/etc/systemd/system/link4alias.service" "link4.service"
-islink "$root/etc/systemd/system/link4alias2.service" "link4.service"
+islink "$root/etc/systemd/system/link4alias.service" "/etc/systemd/system/link4.service"
+islink "$root/etc/systemd/system/link4alias2.service" "/etc/systemd/system/link4.service"
"$systemctl" --root="$root" disable 'link4.service'
test ! -h "$root/etc/systemd/system/link4.service"
@@ -453,8 +453,8 @@ EOF
# Apparently this works. I'm not sure what to think.
"$systemctl" --root="$root" enable '/etc/systemd/system/link4.service'
test ! -h "$root/etc/systemd/system/link4.service" # this is our file
-islink "$root/etc/systemd/system/link4alias.service" "link4.service"
-islink "$root/etc/systemd/system/link4alias2.service" "link4.service"
+islink "$root/etc/systemd/system/link4alias.service" "/etc/systemd/system/link4.service"
+islink "$root/etc/systemd/system/link4alias2.service" "/etc/systemd/system/link4.service"
"$systemctl" --root="$root" disable '/etc/systemd/system/link4.service'
test ! -h "$root/etc/systemd/system/link4.service"
@@ -472,8 +472,8 @@ EOF
"$systemctl" --root="$root" enable 'link5.service'
test ! -h "$root/etc/systemd/system/link5.service" # this is our file
-islink "$root/etc/systemd/system/link5alias.service" "link5.service"
-islink "$root/etc/systemd/system/link5alias2.service" "link5.service"
+islink "$root/etc/systemd/system/link5alias.service" "/etc/systemd/system/link5.service"
+islink "$root/etc/systemd/system/link5alias2.service" "/etc/systemd/system/link5.service"
"$systemctl" --root="$root" disable 'link5.service'
test ! -h "$root/etc/systemd/system/link5alias.service"
@@ -495,6 +495,10 @@ islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service'
test ! -h "$root/etc/systemd/system/link5alias.service"
test ! -h "$root/etc/systemd/system/link5alias2.service"
+# FIXME: we must create link5alias2 and link5alias as relative links to link5.service
+# When they are independent links to /link5.service, systemd doesn't know that
+# they are aliases, because we do not follow symlinks outside of the search paths.
+
"$systemctl" --root="$root" disable 'link5copy.service'
test ! -h "$root/etc/systemd/system/link5copy.service"
test ! -h "$root/etc/systemd/system/link5alias.service"
@@ -502,8 +506,8 @@ test ! -h "$root/etc/systemd/system/link5alias2.service"
"$systemctl" --root="$root" enable '/link5copy.service'
islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service'
-islink "$root/etc/systemd/system/link5alias.service" 'link5copy.service'
-islink "$root/etc/systemd/system/link5alias2.service" 'link5copy.service'
+islink "$root/etc/systemd/system/link5alias.service" '/link5copy.service'
+islink "$root/etc/systemd/system/link5alias2.service" '/link5copy.service'
"$systemctl" --root="$root" disable 'link5copy.service'
test ! -h "$root/etc/systemd/system/link5copy.service"
@@ -522,10 +526,10 @@ EOF
"$systemctl" --root="$root" enable 'link5@.path'
test ! -h "$root/etc/systemd/system/link5@.path" # this is our file
-islink "$root/etc/systemd/system/target5@.target.wants/link5@.path" "../link5@.path"
-islink "$root/etc/systemd/system/target5@.target.requires/link5@.path" "../link5@.path"
-islink "$root/etc/systemd/system/target5@inst.target.wants/link5@.path" "../link5@.path"
-islink "$root/etc/systemd/system/target5@inst.target.requires/link5@.path" "../link5@.path"
+islink "$root/etc/systemd/system/target5@.target.wants/link5@.path" "/etc/systemd/system/link5@.path"
+islink "$root/etc/systemd/system/target5@.target.requires/link5@.path" "/etc/systemd/system/link5@.path"
+islink "$root/etc/systemd/system/target5@inst.target.wants/link5@.path" "/etc/systemd/system/link5@.path"
+islink "$root/etc/systemd/system/target5@inst.target.requires/link5@.path" "/etc/systemd/system/link5@.path"
"$systemctl" --root="$root" disable 'link5@.path'
test ! -h "$root/etc/systemd/system/link5@.path" # this is our file
@@ -564,7 +568,7 @@ check_alias() {
Alias=target@$1:%$1.socket
EOF
SYSTEMD_LOG_LEVEL=debug "$systemctl" --root="$root" enable 'some-some-link6@.socket' || return 1
- islink "$root/etc/systemd/system/target@$1:$2.socket" "some-some-link6@.socket" || return 2
+ islink "$root/etc/systemd/system/target@$1:$2.socket" "/etc/systemd/system/some-some-link6@.socket" || return 2
}
# TODO: our architecture names are different than what uname -m returns.
@@ -670,10 +674,10 @@ 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" "../some-some-link7.socket"
-islink "$root/etc/systemd/system/another-target@.target.wants/some-some-link7.socket" "../some-some-link7.socket"
-islink "$root/etc/systemd/system/target2@some-some-link7.target.requires/some-some-link7.socket" "../some-some-link7.socket"
-islink "$root/etc/systemd/system/another-target2@.target.requires/some-some-link7.socket" "../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"