mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 07:08:01 +02:00
tools: record: record basic os-release information as well
Because sometimes it's useful to know what distro a recording was made on, and the kernel version doesn't always reveal that. Fixes #428 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
7198e33ecf
commit
428acee867
2 changed files with 29 additions and 1 deletions
|
|
@ -1429,7 +1429,7 @@ print_system_header(struct record_context *ctx)
|
||||||
{
|
{
|
||||||
struct utsname u;
|
struct utsname u;
|
||||||
const char *kernel = "unknown";
|
const char *kernel = "unknown";
|
||||||
FILE *dmi;
|
FILE *dmi, *osrelease;
|
||||||
char buf[2048] = "unknown";
|
char buf[2048] = "unknown";
|
||||||
|
|
||||||
if (uname(&u) != -1)
|
if (uname(&u) != -1)
|
||||||
|
|
@ -1447,6 +1447,30 @@ print_system_header(struct record_context *ctx)
|
||||||
|
|
||||||
iprintf(ctx, "system:\n");
|
iprintf(ctx, "system:\n");
|
||||||
indent_push(ctx);
|
indent_push(ctx);
|
||||||
|
|
||||||
|
osrelease = fopen("/etc/os-release", "r");
|
||||||
|
if (!osrelease)
|
||||||
|
fopen("/usr/lib/os-release", "r");
|
||||||
|
if (osrelease) {
|
||||||
|
char *distro = NULL, *version = NULL;
|
||||||
|
|
||||||
|
while (fgets(buf, sizeof(buf), osrelease)) {
|
||||||
|
buf[strlen(buf) - 1] = '\0'; /* linebreak */
|
||||||
|
|
||||||
|
if (!distro && strneq(buf, "ID=", 3))
|
||||||
|
distro = safe_strdup(&buf[3]);
|
||||||
|
else if (!version && strneq(buf, "VERSION_ID=", 11))
|
||||||
|
version = safe_strdup(&buf[11]);
|
||||||
|
|
||||||
|
if (distro && version) {
|
||||||
|
iprintf(ctx, "os: \"%s:%s\"\n", distro, version);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(distro);
|
||||||
|
free(version);
|
||||||
|
fclose(osrelease);
|
||||||
|
}
|
||||||
iprintf(ctx, "kernel: \"%s\"\n", kernel);
|
iprintf(ctx, "kernel: \"%s\"\n", kernel);
|
||||||
iprintf(ctx, "dmi: \"%s\"\n", buf);
|
iprintf(ctx, "dmi: \"%s\"\n", buf);
|
||||||
indent_pop(ctx);
|
indent_pop(ctx);
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ ndevices: 2
|
||||||
libinput:
|
libinput:
|
||||||
version: 1.10.0
|
version: 1.10.0
|
||||||
system:
|
system:
|
||||||
|
os: "fedora:26"
|
||||||
kernel: "4.13.9-200.fc26.x86_64"
|
kernel: "4.13.9-200.fc26.x86_64"
|
||||||
dmi: "dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:..."
|
dmi: "dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:..."
|
||||||
devices:
|
devices:
|
||||||
|
|
@ -206,6 +207,9 @@ libinput version
|
||||||
.SS system
|
.SS system
|
||||||
Information about the system
|
Information about the system
|
||||||
.TP 8
|
.TP 8
|
||||||
|
.B os: string
|
||||||
|
Distribution ID and version, see \fIos-release(5)\fR
|
||||||
|
.TP 8
|
||||||
.B kernel: string
|
.B kernel: string
|
||||||
Kernel version, see \fIuname(1)\fR
|
Kernel version, see \fIuname(1)\fR
|
||||||
.TP 8
|
.TP 8
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue