shared/install: fix handling of a linked unit file

When we have a symlink that goes outside of our search path, we should just
ignore the target file name. But we were verifying it, and rejecting in
the case where a symlink was created manually.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-03-29 16:17:57 +02:00
parent 48ed75adab
commit 48eadb9d9b
2 changed files with 11 additions and 5 deletions
+8 -4
View File
@@ -216,12 +216,16 @@ cat >"$root/link3.suffix" <<EOF
WantedBy=services.target
EOF
# We wouldn't create such a link ourselves, but it should accept it when present.
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"
# unit_file_load_or_readlink() needs to be fixed to not follow links
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"
SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_LOCATION=1 "$systemctl" --root="$root" disable 'link3.service'
test ! -h "$root/etc/systemd/system/link3.service"
test ! -h "$root/etc/systemd/system/services.target.wants/link3.service"
: -------enable on masked-------------------------------------
ln -s "/dev/null" "$root/etc/systemd/system/masked.service"