systemctl: honour --root= in "is-enabled --full"
We have a root argument, let's make sure we honour it in this case. (cherry picked from commit b231b43ff0c3a4b951e45567474052885cad52d3)
This commit is contained in:
committed by
Luca Boccassi
parent
c74e3aa5b7
commit
3d267223ea
@@ -27,7 +27,7 @@ static int show_installation_targets_client_side(const char *name) {
|
||||
flags = UNIT_FILE_DRY_RUN |
|
||||
(arg_runtime ? UNIT_FILE_RUNTIME : 0);
|
||||
|
||||
r = unit_file_disable(arg_runtime_scope, flags, NULL, p, &changes, &n_changes);
|
||||
r = unit_file_disable(arg_runtime_scope, flags, arg_root, p, &changes, &n_changes);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get file links for %s: %m", name);
|
||||
|
||||
|
||||
@@ -754,3 +754,15 @@ ID='the-id2'
|
||||
EOF
|
||||
|
||||
SYSTEMD_OS_RELEASE="/etc/os-release2" check_alias o 'the-id2'
|
||||
|
||||
: '-------is-enabled --full is relative to --root=-----------------'
|
||||
mkdir -p "$root/usr/lib/systemd/system"
|
||||
cat >"$root/usr/lib/systemd/system/rooted.service" <<EOF
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
"$systemctl" --root="$root" enable rooted.service
|
||||
|
||||
# Without --root= being passed on this inspects the host, which knows nothing about this unit.
|
||||
"$systemctl" --root="$root" is-enabled --full rooted.service |
|
||||
grep "^ $root/etc/systemd/system/multi-user.target.wants/rooted.service\$" >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user