From 9376d70f0ccba49ead95ef47f0ecba568ea2d6e1 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Mon, 23 May 2016 04:35:50 -0400
Subject: [PATCH] - added example for REST api

---
 install/lib/install.lib.php |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 67550c8..faee067 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -66,8 +66,32 @@
 	$distid = '';
 	$distbaseid = '';
 
-	//** Debian or Ubuntu
-	if(file_exists('/etc/debian_version')) {
+    //** Debian or Ubuntu
+    if (is_file('/etc/os-release') && stristr(file_get_contents('/etc/os-release'), 'Ubuntu')) {
+        $os_release = file_get_contents('/etc/os-release');
+        if (strstr(trim($os_release), 'LTS')) {
+            $lts = " LTS";
+        } else {
+            $lts = "";
+        }
+
+        preg_match("/.*VERSION=\"(.*)\".*/ui", $os_release, $ver);
+        $ver = str_replace("LTS", "", $ver[1]);
+        $ver = explode(" ", $ver, 2);
+        $relname = end($ver);
+        $relname = "(" . trim(trim($relname), "()") . ")";
+        $distname = 'Ubuntu';
+        $ver = reset($ver);
+        if($ver == "16.04") {
+            $distid = 'ubuntu1604';
+        } else {
+            $distid = 'debian40';
+        }
+        $distbaseid = 'debian';
+        $distver = $ver . $lts . " " . $relname;
+        swriteln("Operating System: " . $distver . "\n");
+    } //** Debian / Ubuntu
+    elseif(file_exists('/etc/debian_version')) {
 		if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu')) {
 			if (strstr(trim(file_get_contents('/etc/issue')), 'LTS')) {
 				$lts=" LTS";
@@ -280,6 +304,12 @@
 			$distid = 'centos53';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: CentOS 6 or compatible\n");
+		} elseif(stristr($content, 'CentOS Linux release 7.2')) {
+			$distname = 'CentOS';
+			$distver = 'Unknown';
+			$distid = 'centos72';
+			$distbaseid = 'fedora';
+			swriteln("Operating System: CentOS 7.2\n");
 		} elseif(stristr($content, 'CentOS Linux release 7')) {
 			$distname = 'CentOS';
 			$distver = 'Unknown';

--
Gitblit v1.9.1