Skip to content

Commit 9d3f20b

Browse files
author
Till Brehm
committed
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
2 parents 1f3c052 + f5daeca commit 9d3f20b

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

install/lib/install.lib.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,28 @@ function get_distname() {
6666
$distid = '';
6767
$distbaseid = '';
6868

69-
//** Debian or Ubuntu
70-
if(file_exists('/etc/debian_version')) {
69+
//** Debian or Ubuntu
70+
if (is_file('/etc/os-release') && stristr(file_get_contents('/etc/os-release'), 'Ubuntu')) {
71+
$os_release = file_get_contents('/etc/os-release');
72+
if (strstr(trim($os_release), 'LTS')) {
73+
$lts = " LTS";
74+
} else {
75+
$lts = "";
76+
}
77+
78+
preg_match("/.*VERSION=\"(.*)\".*/ui", $os_release, $ver);
79+
$ver = str_replace("LTS", "", $ver[1]);
80+
$ver = explode(" ", $ver, 2);
81+
$relname = end($ver);
82+
$relname = "(" . trim(trim($relname), "()") . ")";
83+
$distname = 'Ubuntu';
84+
$ver = reset($ver);
85+
$distid = 'debian40';
86+
$distbaseid = 'debian';
87+
$distver = $ver . $lts . " " . $relname;
88+
swriteln("Operating System: " . $distver . "\n");
89+
} //** Debian / Ubuntu
90+
elseif(file_exists('/etc/debian_version')) {
7191
if (strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu')) {
7292
if (strstr(trim(file_get_contents('/etc/issue')), 'LTS')) {
7393
$lts=" LTS";

0 commit comments

Comments
 (0)