From 8e92f12169578e6f6be1bbf8348bba457dda127f Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 18 Mar 2019 17:14:06 +0100 Subject: Show OpenIndiana release and kernel info in System tab --- src/sysinfo.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp index 27b00b0..91cfee8 100644 --- a/src/sysinfo.cpp +++ b/src/sysinfo.cpp @@ -298,8 +298,10 @@ namespace { void load_uname_info() { this->hostname = uname().nodename; -#ifdef __linux__ +#if defined(__linux__) this->kernel = string(uname().sysname) + ' ' + uname().release + ' ' + uname().machine; +#elif defined(__sun) && defined(__SVR4) + this->kernel = string(uname().sysname) + ' ' + uname().release + ' ' + uname().version + ' ' + uname().machine; #else this->kernel = string(uname().version) + ' ' + uname().machine; #endif @@ -369,12 +371,23 @@ namespace { private: void load_solaris_info() { - this->distro_name = "Solaris"; - std::ifstream input("/etc/release"); - if (input) - std::getline(input, this->distro_release); + if (input) { + std::string s; + std::getline(input, s); + std::size_t found = s.find("OpenIndiana "); + if (found!=std::string::npos) { + this->distro_name = "OpenIndiana"; + this->distro_release = s.substr(found + strlen("OpenIndiana ")); + } else if (!s.empty()) { + this->distro_release = s; + } + } + + if (this->distro_release.empty()) { + this->distro_name = "Solaris"; + } } }; -- cgit v1.2.1