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

2013-02-13 Thread William Giokas
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

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2013-02-13 Thread Lennart Poettering
On Wed, 13.02.13 11:37, William Giokas (1007...@gmail.com) wrote:

 os-release is required for systemd now, so use that file and stop
 printing 'Unknown' on the bootchart.

Actually, this code should probably use load_env_file() instead anyway...

 ---
  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);
  }
  


Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel