Fix display of release information
This commit is contained in:
parent
291d0e19e3
commit
1ce5a35e4e
65
0001-Fix-system-information-on-Fedora.patch
Normal file
65
0001-Fix-system-information-on-Fedora.patch
Normal file
@ -0,0 +1,65 @@
|
||||
From 8ecf9d4feca66b6dec751e8931116ad1e0969b7c Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Clasen <mclasen@redhat.com>
|
||||
Date: Sat, 24 Nov 2012 11:59:20 -0500
|
||||
Subject: [PATCH] Fix system information on Fedora
|
||||
|
||||
lsb_release may not be present, and in that case, we should read
|
||||
/etc/os-release, which is present on all systemd-using distributions
|
||||
and contains the information we need in an easy to parse format.
|
||||
---
|
||||
src/sysinfo.cpp | 37 ++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 36 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
|
||||
index 51e7b44..fd2cf66 100644
|
||||
--- a/src/sysinfo.cpp
|
||||
+++ b/src/sysinfo.cpp
|
||||
@@ -536,9 +536,44 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
+ class GenericSysInfo
|
||||
+ : public SysInfo
|
||||
+ {
|
||||
+ public:
|
||||
+ GenericSysInfo()
|
||||
+ {
|
||||
+ this->load_os_release();
|
||||
+ }
|
||||
+
|
||||
+ private:
|
||||
+ void load_os_release()
|
||||
+ {
|
||||
+ std::ifstream input("/etc/os-release");
|
||||
+
|
||||
+ if (input) {
|
||||
+ while (!input.eof()) {
|
||||
+ string s;
|
||||
+ int len;
|
||||
+ std::getline(input, s);
|
||||
+ if (s.find("NAME=") == 0) {
|
||||
+ len = strlen("NAME=");
|
||||
+ this->distro_name = s.substr(len);
|
||||
+ } else if (s.find("VERSION=") == 0) {
|
||||
+ len = strlen("VERSION=");
|
||||
+ // also strip the surrounding quotes
|
||||
+ this->distro_release = s.substr(len + 1, s.size() - len - 2);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
SysInfo* get_sysinfo()
|
||||
{
|
||||
- if (char *p = g_find_program_in_path("lsb_release")) {
|
||||
+ if (g_file_test ("/etc/os-release", G_FILE_TEST_EXISTS)) {
|
||||
+ return new GenericSysInfo;
|
||||
+ }
|
||||
+ else if (char *p = g_find_program_in_path("lsb_release")) {
|
||||
g_free(p);
|
||||
return new LSBSysInfo;
|
||||
}
|
||||
--
|
||||
1.8.0
|
||||
|
@ -10,13 +10,16 @@
|
||||
Summary: Process and resource monitor
|
||||
Name: gnome-system-monitor
|
||||
Version: 3.6.1
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: GPLv2+
|
||||
Group: Applications/System
|
||||
URL: http://www.gnome.org/
|
||||
#VCS: git:git://git.gnome.org/gnome-system-monitor
|
||||
Source: http://download.gnome.org/sources/gnome-system-monitor/3.6/%{name}-%{version}.tar.xz
|
||||
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=688981
|
||||
Patch0: 0001-Fix-system-information-on-Fedora.patch
|
||||
|
||||
BuildRequires: libgtop2-devel >= %{libgtop2_version}
|
||||
BuildRequires: libwnck3-devel >= %{libwnck_version}
|
||||
BuildRequires: gtk3-devel
|
||||
@ -40,6 +43,7 @@ such as CPU and memory.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%configure --enable-systemd
|
||||
@ -76,6 +80,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Nov 24 2012 Matthias Clasen <mclasen@redhat.com> - 3.6.1-3
|
||||
- Fix display of distro information
|
||||
|
||||
* Mon Oct 29 2012 Matthias Clasen <mclasen@redhat.com> - 3.6.1-2
|
||||
- Display systemd information
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user