From b28e0b02756c4d5b84ca9040f04ef6c90fbf00db Mon Sep 17 00:00:00 2001 From: Hugues Granger Date: Sun, 26 Oct 2014 15:01:34 +0100 Subject: [PATCH 1/2] Fix distro name for some more platforms (e.g. Raspbian). --- libs/system.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/libs/system.php b/libs/system.php index b814432..1b0482e 100644 --- a/libs/system.php +++ b/libs/system.php @@ -7,21 +7,9 @@ $hostname = php_uname('n'); // OS if (!($os = shell_exec('/usr/bin/lsb_release -ds'))) { - if (!($os = shell_exec('cat /etc/fedora-release'))) + if (!($os = shell_exec('find /etc/*-release -type f -exec cat {} \; | grep NAME | tail -n 1 | cut -d= -f2 | tr -d \'"\''))) { - if (!($os = shell_exec('cat /etc/redhat-release'))) - { - if (!($os = shell_exec('cat /etc/mandriva-release'))) - { - if (!($os = shell_exec('cat /etc/SuSE-release'))) - { - if (!($os = shell_exec('cat /etc/centos-release'))) - { - $os = 'N.A'; - } - } - } - } + $os = 'N.A'; } } From 7e44ecbd4710e6eb9409daaded9064180ff9aefd Mon Sep 17 00:00:00 2001 From: Hugues Granger Date: Mon, 10 Nov 2014 16:37:10 +0100 Subject: [PATCH 2/2] Fix for RedHat/CentOS. --- libs/system.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/system.php b/libs/system.php index 1b0482e..62ca9cc 100644 --- a/libs/system.php +++ b/libs/system.php @@ -7,9 +7,12 @@ $hostname = php_uname('n'); // OS if (!($os = shell_exec('/usr/bin/lsb_release -ds'))) { - if (!($os = shell_exec('find /etc/*-release -type f -exec cat {} \; | grep NAME | tail -n 1 | cut -d= -f2 | tr -d \'"\''))) + if(!($os = shell_exec('cat /etc/system-release'))) { - $os = 'N.A'; + if (!($os = shell_exec('find /etc/*-release -type f -exec cat {} \; | grep NAME | tail -n 1 | cut -d= -f2 | tr -d \'"\''))) + { + $os = 'N.A'; + } } }