1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

os-util: make $SYSTEMD_OS_RELEASE prefixed with the root directory

To make it consistent with other env vars, e.g. $SYSTEMD_ESP_PATH or
$SYSTEMD_XBOOTLDR_PATH.

This is useful when the root is specified by a file descriptor, instead
of a path.
This commit is contained in:
Yu Watanabe 2023-04-08 22:33:40 +09:00
parent f4a1d32c82
commit 5cf69e709e
3 changed files with 3 additions and 4 deletions

View File

@ -45,8 +45,7 @@ All tools:
* `$SYSTEMD_OS_RELEASE` — if set, use this path instead of `/etc/os-release` or
`/usr/lib/os-release`. When operating under some root (e.g. `systemctl
--root=…`), the path is taken relative to the outside root. Only useful for
debugging.
--root=…`), the path is prefixed with the root. Only useful for debugging.
* `$SYSTEMD_FSTAB` — if set, use this path instead of `/etc/fstab`. Only useful
for debugging.

View File

@ -128,7 +128,7 @@ int open_os_release(const char *root, char **ret_path, int *ret_fd) {
e = secure_getenv("SYSTEMD_OS_RELEASE");
if (e)
return chase(e, root, 0, ret_path, ret_fd);
return chase(e, root, CHASE_PREFIX_ROOT, ret_path, ret_fd);
FOREACH_STRING(path, "/etc/os-release", "/usr/lib/os-release") {
r = chase(path, root, CHASE_PREFIX_ROOT, ret_path, ret_fd);

View File

@ -695,4 +695,4 @@ cat >"$root/etc/os-release2" <<EOF
ID='the-id2'
EOF
SYSTEMD_OS_RELEASE="$root/etc/os-release2" check_alias o 'the-id2'
SYSTEMD_OS_RELEASE="/etc/os-release2" check_alias o 'the-id2'