]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
os-util: make $SYSTEMD_OS_RELEASE prefixed with the root directory
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 8 Apr 2023 13:33:40 +0000 (22:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 11 Apr 2023 09:49:23 +0000 (18:49 +0900)
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.

docs/ENVIRONMENT.md
src/basic/os-util.c
test/test-systemctl-enable.sh

index 292a0f1e0e176e6780315a5ec5e54294a813c45b..445131b479b86d937c03596aa6251b56cc5bfa23 100644 (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.
index 16fe123ce649883db885032a230ee86a9f8f7d50..0f123aaf8297fd564c630f59bac43abdc555096a 100644 (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);
index 7d5667f2975eb3e2da2bfd678cb5ca1b83a6e262..e22a3ef628eff155edd790b8db2ad11107078992 100644 (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'