@@ -315,47 +315,66 @@ function get_distname() {
315315 swriteln ("Operating System: Fedora 33 or compatible \n" );
316316 //** RHEL 7 and compatible clones
317317 } elseif (preg_match ('/^(?:7|7\.[0-9]{1,2})$/ ' , $ versionid [0 ])) {
318- preg_match_all ('/([0-9]{1,2})\.?([0-9]{0,2})\.?([0-9]*)/ ' , file_get_contents ('/etc/redhat-release ' ), $ centos7_string );
318+ preg_match_all ('/([0-9]{1,2})\.?([0-9]{0,2})\.?([0-9]*)/ ' , file_get_contents ('/etc/redhat-release ' ), $ centos7_version );
319319 $ distname = $ name [0 ];
320- $ distver = is_array ($ centos7_string )? implode ('. ' , array_filter (array ($ centos7_string [1 ][0 ],$ centos7_string [2 ][0 ],$ centos7_string [3 ][0 ]),'strlen ' )) : $ version [0 ];
320+ $ distver = is_array ($ centos7_version )? implode ('. ' , array_filter (array ($ centos7_version [1 ][0 ],$ centos7_version [2 ][0 ],$ centos7_version [3 ][0 ]),'strlen ' )) : $ version [0 ];
321321 $ distid = 'centos72 ' ;
322- $ distbaseid = 'fedora ' ;
323- swriteln ("Operating System: RHEL/CentOS 7 or compatible \n" );
324- //** RHEL 8 and compatible clones
322+ $ distbaseid = 'fedora ' ;
323+ swriteln ("Operating System: " . $ distname . " " . $ distver . " \n" );
324+ //** RHEL 8 and compatible clones
325325 } elseif (preg_match ('/^(?:8|8\.[0-9]{1,2})$/ ' , $ versionid [0 ])) {
326326 $ distname = $ name [0 ];
327327 $ distver = $ version [0 ];
328328 $ distid = 'centos80 ' ;
329329 $ distbaseid = 'fedora ' ;
330- swriteln ("Operating System: RHEL/CentOS 8 or compatible \n" );
331- } else {
330+ swriteln ("Operating System: " . $ prettyname [ 0 ] . " \n" );
331+ } else {
332332 $ distname = 'Redhat ' ;
333333 $ distver = 'Unknown ' ;
334334 $ distid = 'fedora9 ' ;
335335 $ distbaseid = 'fedora ' ;
336336 swriteln ("Operating System: Redhat or compatible \n" );
337337 }
338- //** RHEL 6 and compatible clones
339- } elseif (file_exists ('/etc/redhat-release ' ) && !file_exists ('/etc/os-release ' )) {
338+ //** CentOS 6
339+ } elseif (file_exists ('/etc/redhat-release ' ) && !file_exists ('/etc/os-release ' ) && ! file_exists ( ' /etc/els-release ' ) ) {
340340
341341 $ content = file_get_contents ('/etc/redhat-release ' );
342342
343343 if (stristr ($ content , 'CentOS Linux release 6 ' ) || stristr ($ content , 'CentOS release 6 ' )) {
344- $ distname = 'CentOS ' ;
345- $ distver = 'Unknown ' ;
344+ preg_match_all ('/(6\.?([0-9]{0,2})\.?(\s)?([a-zA-Z()]+))$/ ' , $ content , $ centos6_version );
345+ $ distname = 'CentOS Linux ' ;
346+ $ distver = is_array ($ centos6_version )? implode ('. ' , array_filter (array ($ centos6_version [0 ][0 ]),'strlen ' )) : '6 ' ;
346347 $ distid = 'centos53 ' ;
347- $ distbaseid = 'fedora ' ;
348- swriteln ("Operating System: CentOS/RHEL 6 or compatible \n" );
348+ $ distbaseid = 'fedora ' ;
349+ swriteln ("Operating System: " . $ distname . " " . $ distver . "\n" );
350+
349351 } else {
350352 $ distname = 'Redhat ' ;
351353 $ distver = 'Unknown ' ;
352354 $ distid = 'fedora9 ' ;
353355 $ distbaseid = 'fedora ' ;
354- swriteln ("Operating System: Redhat or compatible \n" );
355356 }
357+ //** CentOS 6 Extended Lifecycle Support by CloudLinux
358+ } elseif (file_exists ('/etc/redhat-release ' ) && file_exists ('/etc/els-release ' ) && !file_exists ('/etc/os-release ' )) {
356359
360+ $ content = file_get_contents ('/etc/els-release ' );
361+
362+ if (stristr ($ content , 'CentOS Linux release 6 ' ) || stristr ($ content , 'CentOS release 6 ' )) {
363+ preg_match_all ('/(6)\.?([0-9]{0,2})?\.?\s([a-zA-Z(), ]+)?$/ ' , $ content , $ centos6_version );
364+ $ distname = 'CentOS Linux ' ;
365+ $ distver = $ centos6_version [0 ][0 ];
366+ $ distid = 'centos53 ' ;
367+ $ distbaseid = 'fedora ' ;
368+ swriteln ("Operating System: " . $ distname . " " . $ distver . "\n" );
369+ } else {
370+ $ distname = 'Redhat ' ;
371+ $ distver = 'Unknown ' ;
372+ $ distid = 'fedora9 ' ;
373+ $ distbaseid = 'fedora ' ;
374+ }
357375 }
358376
377+
359378 //** Gentoo
360379 elseif (file_exists ('/etc/gentoo-release ' )) {
361380
0 commit comments