diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-06-13 19:45:52 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-06-13 20:11:59 +0200 |
commit | 5ae4d543cb9b45ad6c6b82b78da1d6abc2291cdb (patch) | |
tree | cf4d8817660f9a2a828c16ce42392703a5ccd690 /src/hostname | |
parent | b0284aba93e8ccd415da5bbee86d84c12b1b9856 (diff) |
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.
Diffstat (limited to 'src/hostname')
-rw-r--r-- | src/hostname/hostnamed.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index a3504904a0..241d296916 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -108,6 +108,13 @@ static int context_read_data(Context *c) { "PRETTY_NAME", &c->data[PROP_OS_PRETTY_NAME], "CPE_NAME", &c->data[PROP_OS_CPE_NAME], NULL); + if (r == -ENOENT) { + r = parse_env_file("/usr/lib/os-release", NEWLINE, + "PRETTY_NAME", &c->data[PROP_OS_PRETTY_NAME], + "CPE_NAME", &c->data[PROP_OS_CPE_NAME], + NULL); + } + if (r < 0 && r != -ENOENT) return r; |