diff options
author | Debian CLI Applications Team <pkg-cli-apps-team@lists.alioth.debian.org> | 2017-05-24 21:06:47 +0100 |
---|---|---|
committer | Andreas Moog <andreas.moog@warperbbs.de> | 2017-05-24 21:06:47 +0100 |
commit | 411fc5915410a4304482a041c8bd3e07662f68b9 (patch) | |
tree | ad3fb910a1fb7407df15d8995eb3eab6d3c3348b | |
parent | 985ed368e81e4734e1152910f9dcf478a846383c (diff) |
ubuntu_lsb_release
===================================================================
Gbp-Pq: Name 09-ubuntu_lsb_release.diff
-rw-r--r-- | Sysinfo/SystemInfo.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Sysinfo/SystemInfo.cs b/Sysinfo/SystemInfo.cs index e3a7570..e4bfa5d 100644 --- a/Sysinfo/SystemInfo.cs +++ b/Sysinfo/SystemInfo.cs @@ -30,6 +30,8 @@ namespace Sysinfo { //read release info public void Release() { + + String temp; try { @@ -125,6 +127,31 @@ namespace Sysinfo { } } + if (File.Exists("/etc/lsb-release")) { + using (TextReader textread = File.OpenText("/etc/lsb-release")) { + + while ( (temp = textread.ReadLine()) != null ) { + + // get distro + if ( temp.StartsWith("DISTRIB_ID=") ) { + distro = temp.Substring(11); + } + + // get release + if ( temp.StartsWith("DISTRIB_RELEASE=") ) { + system_release = temp.Substring(16); + } + + // get codename + if ( temp.StartsWith("DISTRIB_CODENAME=") ) { + system_release = String.Concat(system_release, " (", temp.Substring(17), ")"); + } + + } + system_release = String.Concat(distro, " ", system_release); + } + } + } catch (FileNotFoundException ex) { Console.WriteLine( ex ); } } |