os-release: define /usr/lib/os-release as fallback for /etc/os-release
The file should have been in /usr/lib/ in the first place, since it describes the OS container in /usr (and not the configuration in /etc), hence, let's support os-release files in /usr/lib as fallback if no version in /etc exists, following the usual override logic. A prior commit already enabled tmpfiles to create /etc/os-release as a symlink to /usr/lib/os-release should it be missing, thus providing nice compatibility with applications only checking in /etc. While it's probably a good idea if all apps check both locations via a fallback logic, it is only necessary in the early boot process, as long as the /etc/os-release symlink has not been restored, in case we boot with an empty /etc.
This commit is contained in:
@@ -386,10 +386,10 @@ int main(int argc, char *argv[]) {
|
||||
if (sysfd < 0)
|
||||
sysfd = open("/sys", O_RDONLY|O_CLOEXEC);
|
||||
|
||||
if (!build)
|
||||
parse_env_file("/etc/os-release", NEWLINE,
|
||||
"PRETTY_NAME", &build,
|
||||
NULL);
|
||||
if (!build) {
|
||||
if (parse_env_file("/etc/os-release", NEWLINE, "PRETTY_NAME", &build, NULL) == -ENOENT)
|
||||
parse_env_file("/usr/lib/os-release", NEWLINE, "PRETTY_NAME", &build, NULL);
|
||||
}
|
||||
|
||||
/* wait for /proc to become available, discarding samples */
|
||||
if (graph_start <= 0.0)
|
||||
|
||||
Reference in New Issue
Block a user