[systemd-devel] [PATCH] bootchart: Use os-release, not system-release

William Giokas 1007380 at gmail.com
Wed Feb 13 09:37:37 PST 2013


os-release is required for systemd now, so use that file and stop
printing 'Unknown' on the bootchart.
---
 src/bootchart/svg.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index d7c4168..ec81da9 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -195,11 +195,15 @@ static void svg_title(void)
                 fclose(f);
         }
 
-        /* Build - 1st line from /etc/system-release */
-        f = fopen("/etc/system-release", "r");
+        /* Build - NAME line from /etc/os-release */
+        f = fopen("/etc/os-release", "r");
         if (f) {
-                if (fgets(buf, 255, f))
-                        strncpy(build, buf, 255);
+                while (fgets(buf, 255, f)) {
+                        if (strstr(buf, "NAME=")) {
+                                strncpy(build, &buf[5], 255);
+                                break;
+                        }
+                }
                 fclose(f);
         }
 
-- 
1.8.1.3.566.gaa39828



More information about the systemd-devel mailing list