diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-10-27 10:48:46 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-10-27 10:48:46 -0400 |
commit | 6ad2186f0e519541949496b32a7219520ddb6bba (patch) | |
tree | 8f1b088996471d4d13fcbe3cdac462ded7c64183 /sway/main.c | |
parent | 0d6cbcacbe864cab2a4c74343e8af2b80e535bd6 (diff) |
Log contents of distro version files
Diffstat (limited to 'sway/main.c')
-rw-r--r-- | sway/main.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/main.c b/sway/main.c index 015fe247..804053f6 100644 --- a/sway/main.c +++ b/sway/main.c @@ -101,6 +101,31 @@ static void log_env() { } } +static void log_distro() { + const char *paths[] = { + "/etc/lsb-release", + "/etc/os-release", + "/etc/debian_version", + "/etc/redhat-release", + "/etc/redhat-release", + "/etc/gentoo-release", + }; + for (size_t i = 0; i < sizeof(paths) / sizeof(char *); ++i) { + FILE *f = fopen(paths[i], "r"); + if (f) { + sway_log(L_INFO, "Contents of %s:", paths[i]); + while (!feof(f)) { + char *line = read_line(f); + if (*line) { + sway_log(L_INFO, "%s", line); + } + free(line); + } + fclose(f); + } + } +} + int main(int argc, char **argv) { static int verbose = 0, debug = 0, validate = 0; @@ -237,6 +262,7 @@ int main(int argc, char **argv) { sway_log(L_INFO, "Starting sway version %s (%s, branch \"%s\")\n", SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); #endif log_env(); + log_distro(); init_layout(); |