Skip to content

Commit 7617f79

Browse files
author
Till Brehm
committed
Use improved centos version recognition from @dario.git.ispc
1 parent 2537657 commit 7617f79

File tree

2 files changed

+18
-58
lines changed

2 files changed

+18
-58
lines changed

install/lib/install.lib.php

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -297,40 +297,19 @@ function get_distname() {
297297
$distid = 'centos53';
298298
$distbaseid = 'fedora';
299299
swriteln("Operating System: CentOS 6 or compatible\n");
300-
} elseif(stristr($content, 'CentOS Linux release 7.2')) {
301-
$distname = 'CentOS';
302-
$distver = 'Unknown';
303-
$distid = 'centos72';
304-
$distconfid = 'centos72';
305-
$distbaseid = 'fedora';
306-
swriteln("Operating System: CentOS 7.2\n");
307-
} elseif(stristr($content, 'CentOS Linux release 7.3')) {
308-
$distname = 'CentOS';
309-
$distver = 'Unknown';
310-
$distid = 'centos72';
311-
$distconfid = 'centos72';
312-
$distbaseid = 'fedora';
313-
swriteln("Operating System: CentOS 7.3\n");
314-
} elseif(stristr($content, 'CentOS Linux release 7.4')) {
315-
$distname = 'CentOS';
316-
$distver = 'Unknown';
317-
$distid = 'centos72';
318-
$distconfid = 'centos72';
319-
$distbaseid = 'fedora';
320-
swriteln("Operating System: CentOS 7.4\n");
321-
} elseif(stristr($content, 'CentOS Linux release 7.5')) {
322-
$distname = 'CentOS';
323-
$distver = 'Unknown';
324-
$distid = 'centos72';
325-
$distconfid = 'centos72';
326-
$distbaseid = 'fedora';
327-
swriteln("Operating System: CentOS 7.5\n");
328300
} elseif(stristr($content, 'CentOS Linux release 7')) {
329301
$distname = 'CentOS';
330302
$distver = 'Unknown';
331-
$distid = 'centos70';
332303
$distbaseid = 'fedora';
333-
swriteln("Operating System: CentOS 7 or compatible\n");
304+
$var=explode(" ", $content);
305+
$var=explode(".", $var[3]);
306+
$var=$var[0].".".$var[1];
307+
if($var=='7.0' || $var=='7.1') {
308+
$distid = 'centos70';
309+
} else {
310+
$distid = 'centos72';
311+
}
312+
swriteln("Operating System: CentOS $var\n");
334313
} else {
335314
$distname = 'Redhat';
336315
$distver = 'Unknown';

server/lib/classes/monitor_tools.inc.php

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -273,38 +273,19 @@ function get_distname() {
273273
$distver = 'Unknown';
274274
$distid = 'centos53';
275275
$distbaseid = 'fedora';
276-
} elseif(stristr($content, 'CentOS Linux release 7.2')) {
277-
$distname = 'CentOS';
278-
$distver = 'Unknown';
279-
$distid = 'centos70';
280-
$distconfid = 'centos72';
281-
$distbaseid = 'fedora';
282-
} elseif(stristr($content, 'CentOS Linux release 7.3')) {
283-
$distname = 'CentOS';
284-
$distver = 'Unknown';
285-
$distid = 'centos72';
286-
$distconfid = 'centos72';
287-
$distbaseid = 'fedora';
288-
swriteln("Operating System: CentOS 7.3\n");
289-
} elseif(stristr($content, 'CentOS Linux release 7.4')) {
290-
$distname = 'CentOS';
291-
$distver = 'Unknown';
292-
$distid = 'centos72';
293-
$distconfid = 'centos72';
294-
$distbaseid = 'fedora';
295-
swriteln("Operating System: CentOS 7.4\n");
296-
} elseif(stristr($content, 'CentOS Linux release 7.5')) {
297-
$distname = 'CentOS';
298-
$distver = 'Unknown';
299-
$distid = 'centos72';
300-
$distconfid = 'centos72';
301-
$distbaseid = 'fedora';
302-
swriteln("Operating System: CentOS 7.5\n");
303276
} elseif(stristr($content, 'CentOS Linux release 7')) {
304277
$distname = 'CentOS';
305278
$distver = 'Unknown';
306-
$distid = 'centos70';
307279
$distbaseid = 'fedora';
280+
$var=explode(" ", $content);
281+
$var=explode(".", $var[3]);
282+
$var=$var[0].".".$var[1];
283+
if($var=='7.0' || $var=='7.1') {
284+
$distid = 'centos70';
285+
} else {
286+
$distid = 'centos72';
287+
}
288+
swriteln("Operating System: CentOS $var\n");
308289
} else {
309290
$distname = 'Redhat';
310291
$distver = 'Unknown';

0 commit comments

Comments
 (0)