From 7e751f28f66efe19b4abe427e0e08842ac352573 Mon Sep 17 00:00:00 2001 From: infirit Date: Wed, 17 Dec 2014 17:46:27 +0100 Subject: Add OpenBSD support Add OpenBSDSysInfo() for getting OpenBSD system information Taken from GSM commit: 8cc3d4d04963bc5f4e70fa6d81a8ad009eac9021 From: Antoine Jacoutot Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=652584 --- src/sysinfo.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp index 82cdcf7..6e7ce54 100644 --- a/src/sysinfo.cpp +++ b/src/sysinfo.cpp @@ -420,6 +420,28 @@ namespace { }; + class OpenBSDSysInfo + : public SysInfo + { + public: + OpenBSDSysInfo() + { + this->load_openbsd_info(); + } + + private: + void load_openbsd_info() + { + this->distro_name = "OpenBSD"; + this->distro_release = this->kernel; + + std::ifstream input("/etc/motd"); + + if (input) + std::getline(input, this->kernel); + } + }; + SysInfo* get_sysinfo() { if (g_file_test ("/etc/os-release", G_FILE_TEST_EXISTS)) { @@ -435,6 +457,9 @@ namespace { else if (SysInfo::system() == "NetBSD") { return new NetBSDSysInfo; } + else if (SysInfo::system() == "OpenBSD") { + return new OpenBSDSysInfo; + } return new SysInfo; } -- cgit v1.2.1