summaryrefslogtreecommitdiffstats
path: root/src/firstboot
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-26 16:32:40 +0200
committerLennart Poettering <lennart@poettering.net>2018-05-24 17:01:57 +0200
commitd58ad743f98b3a88de961462fb7adedbf30f727d (patch)
tree0978f88d2e97ef6aacd032b0c6540c70906f5207 /src/firstboot
parentfileio: add parse_env_filev() that is like parse_env_file() but takes a va_list (diff)
downloadsystemd-d58ad743f98b3a88de961462fb7adedbf30f727d.tar.xz
systemd-d58ad743f98b3a88de961462fb7adedbf30f727d.zip
os-util: add helpers for finding /etc/os-release
Place this new helpers in a new source file os-util.[ch], and move the existing and related call path_is_os_tree() to it as well.
Diffstat (limited to 'src/firstboot')
-rw-r--r--src/firstboot/firstboot.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index 9b091bf87a..0fc8bb891b 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -33,6 +33,7 @@
#include "hostname-util.h"
#include "locale-util.h"
#include "mkdir.h"
+#include "os-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "proc-cmdline.h"
@@ -79,27 +80,16 @@ static bool press_any_key(void) {
static void print_welcome(void) {
_cleanup_free_ char *pretty_name = NULL;
- const char *os_release = NULL;
static bool done = false;
int r;
if (done)
return;
- os_release = prefix_roota(arg_root, "/etc/os-release");
- r = parse_env_file(NULL, os_release, NEWLINE,
- "PRETTY_NAME", &pretty_name,
- NULL);
- if (r == -ENOENT) {
-
- os_release = prefix_roota(arg_root, "/usr/lib/os-release");
- r = parse_env_file(NULL, os_release, NEWLINE,
- "PRETTY_NAME", &pretty_name,
- NULL);
- }
-
- if (r < 0 && r != -ENOENT)
- log_warning_errno(r, "Failed to read os-release file: %m");
+ r = parse_os_release(arg_root, "PRETTY_NAME", &pretty_name, NULL);
+ if (r < 0)
+ log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r,
+ "Failed to read os-release file, ignoring: %m");
printf("\nWelcome to your new installation of %s!\nPlease configure a few basic system settings:\n\n",
isempty(pretty_name) ? "Linux" : pretty_name);