summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-13 19:45:52 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-13 20:11:59 +0200
commit5ae4d543cb9b45ad6c6b82b78da1d6abc2291cdb (patch)
treecf4d8817660f9a2a828c16ce42392703a5ccd690 /src/core
parentb0284aba93e8ccd415da5bbee86d84c12b1b9856 (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/core')
-rw-r--r--src/core/dbus-manager.c2
-rw-r--r--src/core/main.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 333c1d46e7..68a68a2d94 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1191,7 +1191,7 @@ static int method_switch_root(sd_bus *bus, sd_bus_message *message, void *userda
/* Safety check */
if (isempty(init)) {
if (! path_is_os_tree(root))
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Specified switch root path %s does not seem to be an OS tree. /etc/os-release is missing.", root);
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Specified switch root path %s does not seem to be an OS tree. os-release file is missing.", root);
} else {
_cleanup_free_ char *p = NULL;
diff --git a/src/core/main.c b/src/core/main.c
index d5d1ee2b0c..29f2d5a2a5 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1251,9 +1251,15 @@ static int status_welcome(void) {
"PRETTY_NAME", &pretty_name,
"ANSI_COLOR", &ansi_color,
NULL);
+ if (r == -ENOENT) {
+ r = parse_env_file("/usr/lib/os-release", NEWLINE,
+ "PRETTY_NAME", &pretty_name,
+ "ANSI_COLOR", &ansi_color,
+ NULL);
+ }
if (r < 0 && r != -ENOENT)
- log_warning("Failed to read /etc/os-release: %s", strerror(-r));
+ log_warning("Failed to read os-release file: %s", strerror(-r));
return status_printf(NULL, false, false,
"\nWelcome to \x1B[%sm%s\x1B[0m!\n",