Skip to content
Snippets Groups Projects
Commit 9d3f20bb authored by Till Brehm's avatar Till Brehm
Browse files

Merge branch 'stable-3.1' into 'stable-3.1'

Stable 3.1

detect the ubuntu version based on /etc/os-release

See merge request !339
parents 1f3c052e f5daecad
No related branches found
No related tags found
No related merge requests found
...@@ -66,8 +66,28 @@ function get_distname() { ...@@ -66,8 +66,28 @@ function get_distname() {
$distid = ''; $distid = '';
$distbaseid = ''; $distbaseid = '';
//** Debian or Ubuntu //** Debian or Ubuntu
if(file_exists('/etc/debian_version')) { 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);
$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')), 'Ubuntu')) {
if (strstr(trim(file_get_contents('/etc/issue')), 'LTS')) { if (strstr(trim(file_get_contents('/etc/issue')), 'LTS')) {
$lts=" LTS"; $lts=" LTS";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment